Class: RbsGoose::IO::TypedRuby
- Inherits:
-
Object
- Object
- RbsGoose::IO::TypedRuby
- Defined in:
- lib/rbs_goose/io/typed_ruby.rb
Instance Attribute Summary collapse
-
#rbs ⇒ Object
readonly
Returns the value of attribute rbs.
-
#ruby ⇒ Object
readonly
Returns the value of attribute ruby.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ruby:, rbs:) ⇒ TypedRuby
constructor
A new instance of TypedRuby.
- #to_s ⇒ Object
Constructor Details
#initialize(ruby:, rbs:) ⇒ TypedRuby
Returns a new instance of TypedRuby.
18 19 20 21 22 23 24 |
# File 'lib/rbs_goose/io/typed_ruby.rb', line 18 def initialize(ruby:, rbs:) raise ArgumentError, 'ruby must have ".rb" extension' unless ruby.type == :ruby raise ArgumentError, 'rbs must have ".rbs" extension' if !rbs.nil? && rbs.type != :rbs @ruby = ruby @rbs = rbs end |
Instance Attribute Details
#rbs ⇒ Object (readonly)
Returns the value of attribute rbs.
30 31 32 |
# File 'lib/rbs_goose/io/typed_ruby.rb', line 30 def rbs @rbs end |
#ruby ⇒ Object (readonly)
Returns the value of attribute ruby.
30 31 32 |
# File 'lib/rbs_goose/io/typed_ruby.rb', line 30 def ruby @ruby end |
Class Method Details
.from_path(ruby_path:, rbs_path:, base_path:) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rbs_goose/io/typed_ruby.rb', line 7 def from_path(ruby_path:, rbs_path:, base_path:) ruby = File.new(path: ruby_path, base_path:) rbs = begin File.new(path: rbs_path, base_path:) rescue StandardError nil end new(ruby:, rbs:) end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/rbs_goose/io/typed_ruby.rb', line 26 def to_s rbs.nil? ? ruby.to_s : "#{ruby}\n#{rbs}" end |