Class: RBI::TEnumBlock
Instance Attribute Summary collapse
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#annotations, #version_requirements
Methods inherited from Node
#compatible_with?, #detach, #parent_conflict_tree, #parent_scope, #print, #replace, #satisfies_version?, #string
Constructor Details
#initialize(names = [], loc: nil, comments: [], &block) ⇒ TEnumBlock
Returns a new instance of TEnumBlock.
1350
1351
1352
1353
1354
|
# File 'lib/rbi/model.rb', line 1350
def initialize(names = [], loc: nil, comments: [], &block)
super(loc: loc, comments: )
@names = names
block&.call(self)
end
|
Instance Attribute Details
#names ⇒ Object
Returns the value of attribute names.
1340
1341
1342
|
# File 'lib/rbi/model.rb', line 1340
def names
@names
end
|
Instance Method Details
#<<(name) ⇒ Object
1362
1363
1364
|
# File 'lib/rbi/model.rb', line 1362
def <<(name)
@names << name
end
|
#empty? ⇒ Boolean
1357
1358
1359
|
# File 'lib/rbi/model.rb', line 1357
def empty?
names.empty?
end
|
#index_ids ⇒ Object
223
224
225
|
# File 'lib/rbi/index.rb', line 223
def index_ids
[to_s]
end
|
#merge_with(other) ⇒ Object
558
559
560
561
562
563
564
565
|
# File 'lib/rbi/rewriters/merge_trees.rb', line 558
def merge_with(other)
return unless other.is_a?(TEnumBlock)
super
other.names.each do |name|
names << name unless names.include?(name)
end
end
|
#to_s ⇒ Object
1367
1368
1369
|
# File 'lib/rbi/model.rb', line 1367
def to_s
"#{parent_scope&.fully_qualified_name}.enums"
end
|