Class: RBI::TStructConst
- Inherits:
-
TStructField
- Object
- Node
- NodeWithComments
- TStructField
- RBI::TStructConst
- Includes:
- Indexable
- Defined in:
- lib/rbi/index.rb,
lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb
Instance Attribute Summary
Attributes inherited from TStructField
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#compatible_with?(other) ⇒ Boolean
: (Node other) -> bool.
-
#fully_qualified_names ⇒ Object
: -> Array.
-
#index_ids ⇒ Object
: -> Array.
-
#initialize(name, type, default: nil, loc: nil, comments: [], &block) ⇒ TStructConst
constructor
: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array) ?{ (TStructConst node) -> void } -> void.
-
#to_s ⇒ Object
: -> String.
Methods inherited from NodeWithComments
#annotations, #merge_with, #version_requirements
Methods inherited from Node
#detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string
Constructor Details
#initialize(name, type, default: nil, loc: nil, comments: [], &block) ⇒ TStructConst
: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array) ?{ (TStructConst node) -> void } -> void
970 971 972 973 |
# File 'lib/rbi/model.rb', line 970 def initialize(name, type, default: nil, loc: nil, comments: [], &block) super(name, type, default: default, loc: loc, comments: comments) block&.call(self) end |
Instance Method Details
#compatible_with?(other) ⇒ Boolean
: (Node other) -> bool
519 520 521 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 519 def compatible_with?(other) other.is_a?(TStructConst) && super end |
#fully_qualified_names ⇒ Object
: -> Array
977 978 979 980 |
# File 'lib/rbi/model.rb', line 977 def fully_qualified_names parent_name = parent_scope&.fully_qualified_name ["#{parent_name}##{name}"] end |
#index_ids ⇒ Object
: -> Array
199 200 201 |
# File 'lib/rbi/index.rb', line 199 def index_ids fully_qualified_names end |
#to_s ⇒ Object
: -> String
984 985 986 |
# File 'lib/rbi/model.rb', line 984 def to_s "#{parent_scope&.fully_qualified_name}.const(:#{name})" end |