Class: RBI::TStructProp
Instance Attribute Summary
Attributes inherited from TStructField
#default, #name, #type
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#annotations, #comments?, #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: nil, &block) ⇒ TStructProp
Returns a new instance of TStructProp.
1235
1236
1237
1238
|
# File 'lib/rbi/model.rb', line 1235
def initialize(name, type, default: nil, loc: nil, comments: nil, &block)
super(name, type, default: default, loc: loc, comments: )
block&.call(self)
end
|
Instance Method Details
#compatible_with?(other) ⇒ Boolean
615
616
617
|
# File 'lib/rbi/rewriters/merge_trees.rb', line 615
def compatible_with?(other)
other.is_a?(TStructProp) && super
end
|
#fully_qualified_names ⇒ Object
1242
1243
1244
1245
|
# File 'lib/rbi/model.rb', line 1242
def fully_qualified_names
parent_name = parent_scope&.fully_qualified_name
["#{parent_name}##{name}", "#{parent_name}##{name}="]
end
|
#index_ids ⇒ Object
204
205
206
|
# File 'lib/rbi/index.rb', line 204
def index_ids
fully_qualified_names
end
|
#to_s ⇒ Object
1249
1250
1251
|
# File 'lib/rbi/model.rb', line 1249
def to_s
"#{parent_scope&.fully_qualified_name}.prop(:#{name})"
end
|