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: []) ⇒ TypeMember
constructor
A new instance of TypeMember.
- #to_s ⇒ 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, value, loc: nil, comments: []) ⇒ TypeMember
Returns a new instance of TypeMember.
853 854 855 856 857 |
# File 'lib/rbi/model.rb', line 853 def initialize(name, value, loc: nil, comments: []) super(loc: loc, comments: comments) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
850 851 852 |
# File 'lib/rbi/model.rb', line 850 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
850 851 852 |
# File 'lib/rbi/model.rb', line 850 def value @value end |
Instance Method Details
#accept_printer(v) ⇒ Object
593 594 595 596 597 598 599 600 |
# File 'lib/rbi/printer.rb', line 593 def accept_printer(v) previous_node = v.previous_node v.printn if previous_node && (!previous_node.oneline? || !oneline?) v.printl("# #{loc}") if loc && v.print_locs v.visit_all(comments) v.printl("#{name} = #{value}") end |
#fully_qualified_name ⇒ Object
860 861 862 863 |
# File 'lib/rbi/model.rb', line 860 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |
#to_s ⇒ Object
866 867 868 |
# File 'lib/rbi/model.rb', line 866 def to_s fully_qualified_name end |