Class: RBI::OptParam
- Inherits:
-
Param
- Object
- Node
- NodeWithComments
- Param
- RBI::OptParam
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Param
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept_printer(v) ⇒ Object
-
#initialize(name, value, loc: nil, comments: [], &block) ⇒ OptParam
constructor
A new instance of OptParam.
- #print_comment_leading_space(v, last:) ⇒ Object
Methods inherited from Param
Methods inherited from NodeWithComments
#annotations, #merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(name, value, loc: nil, comments: [], &block) ⇒ OptParam
Returns a new instance of OptParam.
608 609 610 611 612 |
# File 'lib/rbi/model.rb', line 608 def initialize(name, value, loc: nil, comments: [], &block) super(name, loc: loc, comments: comments) @value = value block&.call(self) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
597 598 599 |
# File 'lib/rbi/model.rb', line 597 def value @value end |
Instance Method Details
#==(other) ⇒ Object
615 616 617 |
# File 'lib/rbi/model.rb', line 615 def ==(other) OptParam === other && name == other.name && value == other.value end |
#accept_printer(v) ⇒ Object
438 439 440 |
# File 'lib/rbi/printer.rb', line 438 def accept_printer(v) v.print("#{name} = #{value}") end |
#print_comment_leading_space(v, last:) ⇒ Object
443 444 445 446 |
# File 'lib/rbi/printer.rb', line 443 def print_comment_leading_space(v, last:) super v.print(" " * (value.size + 3)) end |