class RBI::TEnumBlock
Attributes
names[R]
Public Class Methods
new(names = [], loc: nil, comments: [], &block)
click to toggle source
Calls superclass method
RBI::NodeWithComments::new
# File lib/rbi/model.rb, line 1145 def initialize(names = [], loc: nil, comments: [], &block) super(loc: loc, comments: comments) @names = names block&.call(self) end
Public Instance Methods
<<(name)
click to toggle source
# File lib/rbi/model.rb, line 1157 def <<(name) @names << name end
accept_printer(v)
click to toggle source
# File lib/rbi/printer.rb, line 665 def accept_printer(v) v.printl("# #{loc}") if loc && v.print_locs v.visit_all(comments) v.printl("enums do") v.indent names.each do |name| v.printl("#{name} = new") end v.dedent v.printl("end") end
empty?()
click to toggle source
# File lib/rbi/model.rb, line 1152 def empty? names.empty? end
index_ids()
click to toggle source
# File lib/rbi/index.rb, line 182 def index_ids [to_s] end
merge_with(other)
click to toggle source
Calls superclass method
RBI::NodeWithComments#merge_with
# File lib/rbi/rewriters/merge_trees.rb, line 515 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()
click to toggle source
# File lib/rbi/model.rb, line 1162 def to_s "#{parent_scope&.fully_qualified_name}.enums" end