Class: RBI::TypeMember
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::TypeMember
- Extended by:
- T::Sig
- Includes:
- Indexable
- Defined in:
- lib/rbi/index.rb,
lib/rbi/model.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
- #fully_qualified_name ⇒ Object
- #index_ids ⇒ 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, #version_requirements
Methods inherited from Node
#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string
Constructor Details
#initialize(name, value, loc: nil, comments: [], &block) ⇒ TypeMember
Returns a new instance of TypeMember.
1415 1416 1417 1418 1419 1420 |
# File 'lib/rbi/model.rb', line 1415 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.
1404 1405 1406 |
# File 'lib/rbi/model.rb', line 1404 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
1404 1405 1406 |
# File 'lib/rbi/model.rb', line 1404 def value @value end |
Instance Method Details
#fully_qualified_name ⇒ Object
1423 1424 1425 1426 1427 |
# File 'lib/rbi/model.rb', line 1423 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |
#index_ids ⇒ Object
183 184 185 |
# File 'lib/rbi/index.rb', line 183 def index_ids [to_s] end |
#to_s ⇒ Object
1430 1431 1432 |
# File 'lib/rbi/model.rb', line 1430 def to_s fully_qualified_name end |