Class: RBI::SigParam
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::SigParam
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept_printer(v) ⇒ Object
-
#initialize(name, type, loc: nil, comments: [], &block) ⇒ SigParam
constructor
A new instance of SigParam.
- #print_comment_leading_space(v, last:) ⇒ Object
Methods inherited from NodeWithComments
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(name, type, loc: nil, comments: [], &block) ⇒ SigParam
988 989 990 991 992 993 |
# File 'lib/rbi/model.rb', line 988 def initialize(name, type, loc: nil, comments: [], &block) super(loc: loc, comments: comments) @name = name @type = type block&.call(self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
977 978 979 |
# File 'lib/rbi/model.rb', line 977 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
977 978 979 |
# File 'lib/rbi/model.rb', line 977 def type @type end |
Instance Method Details
#==(other) ⇒ Object
996 997 998 |
# File 'lib/rbi/model.rb', line 996 def ==(other) other.is_a?(SigParam) && name == other.name && type == other.type end |
#accept_printer(v) ⇒ Object
625 626 627 |
# File 'lib/rbi/printer.rb', line 625 def accept_printer(v) v.print("#{name}: #{type}") end |
#print_comment_leading_space(v, last:) ⇒ Object
630 631 632 633 634 635 |
# File 'lib/rbi/printer.rb', line 630 def print_comment_leading_space(v, last:) v.printn v.printt v.print(" " * (name.size + type.size + 3)) v.print(" ") unless last end |