Class: RBI::TypeMember
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::TypeMember
- 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.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #accept_printer(v) ⇒ Object
- #fully_qualified_name ⇒ Object
-
#initialize(name, value, loc: nil, comments: [], &block) ⇒ TypeMember
constructor
A new instance of TypeMember.
- #to_s ⇒ Object
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) ⇒ TypeMember
Returns a new instance of TypeMember.
1323 1324 1325 1326 1327 1328 |
# File 'lib/rbi/model.rb', line 1323 def initialize(name, value, loc: nil, comments: [], &block) super(loc: loc, comments: comments) @name = name @value = value block&.call(self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
1312 1313 1314 |
# File 'lib/rbi/model.rb', line 1312 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
1312 1313 1314 |
# File 'lib/rbi/model.rb', line 1312 def value @value end |
Instance Method Details
#accept_printer(v) ⇒ Object
744 745 746 747 748 749 750 |
# File 'lib/rbi/printer.rb', line 744 def accept_printer(v) print_blank_line_before(v) v.printl("# #{loc}") if loc && v.print_locs v.visit_all(comments) v.printl("#{name} = #{value}") end |
#fully_qualified_name ⇒ Object
1331 1332 1333 1334 |
# File 'lib/rbi/model.rb', line 1331 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |
#to_s ⇒ Object
1337 1338 1339 |
# File 'lib/rbi/model.rb', line 1337 def to_s fully_qualified_name end |