Class: RBI::TypeMember
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::TypeMember
- Includes:
- Indexable
- Defined in:
- lib/rbi/index.rb,
lib/rbi/model.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
: String.
-
#value ⇒ Object
readonly
: String.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#fully_qualified_name ⇒ Object
: -> String.
-
#index_ids ⇒ Object
: -> Array.
-
#initialize(name, value, loc: nil, comments: [], &block) ⇒ TypeMember
constructor
: (String name, String value, ?loc: Loc?, ?comments: Array) ?{ (TypeMember node) -> void } -> void.
-
#to_s ⇒ Object
: -> String.
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
: (String name, String value, ?loc: Loc?, ?comments: Array) ?{ (TypeMember node) -> void } -> void
1164 1165 1166 1167 1168 1169 |
# File 'lib/rbi/model.rb', line 1164 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)
: String
1161 1162 1163 |
# File 'lib/rbi/model.rb', line 1161 def name @name end |
#value ⇒ Object (readonly)
: String
1161 1162 1163 |
# File 'lib/rbi/model.rb', line 1161 def value @value end |
Instance Method Details
#fully_qualified_name ⇒ Object
: -> String
1172 1173 1174 1175 1176 |
# File 'lib/rbi/model.rb', line 1172 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |
#index_ids ⇒ Object
: -> Array
174 175 176 |
# File 'lib/rbi/index.rb', line 174 def index_ids [to_s] end |
#to_s ⇒ Object
: -> String
1180 1181 1182 |
# File 'lib/rbi/model.rb', line 1180 def to_s fully_qualified_name end |