Class: RBI::TStructProp
- Inherits:
-
TStructField
show all
- Extended by:
- T::Sig
- 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
#default, #name, #type
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#accept_printer
#annotations, #merge_with, #oneline?
Methods inherited from Node
#accept_printer, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(name, type, default: nil, loc: nil, comments: [], &block) ⇒ TStructProp
Returns a new instance of TStructProp.
1208
1209
1210
1211
|
# File 'lib/rbi/model.rb', line 1208
def initialize(name, type, default: nil, loc: nil, comments: [], &block)
super(name, type, default: default, loc: loc, comments: )
block&.call(self)
end
|
Instance Method Details
#compatible_with?(other) ⇒ Boolean
559
560
561
|
# File 'lib/rbi/rewriters/merge_trees.rb', line 559
def compatible_with?(other)
other.is_a?(TStructProp) && super
end
|
#fully_qualified_names ⇒ Object
1214
1215
1216
1217
|
# File 'lib/rbi/model.rb', line 1214
def fully_qualified_names
parent_name = parent_scope&.fully_qualified_name
["#{parent_name}##{name}", "#{parent_name}##{name}="]
end
|
#index_ids ⇒ Object
189
190
191
|
# File 'lib/rbi/index.rb', line 189
def index_ids
fully_qualified_names
end
|
#to_s ⇒ Object
1220
1221
1222
|
# File 'lib/rbi/model.rb', line 1220
def to_s
"#{parent_scope&.fully_qualified_name}.prop(:#{name})"
end
|