Class
An “indexed” set. All items must respond to :ident.
Attributes
Read
No documentation available
Class Methods
::
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 17
def initialize(a = [])
@set = a
end
No documentation available
Instance Methods
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 27
def [](key)
@set[key.ident]
end
No documentation available
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 31
def []=(key, val)
@set[key.ident] = val
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 23
def add(i)
@set[i.ident] = i
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 81
def clear
@set.clear
end
No documentation available
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 53
def delete(key)
i = @set[key.ident]
@set[key.ident] = nil
i
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 85
def dup
ISet.new(@set.dup)
end
No documentation available
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 59
def each(&block)
@set.compact.each(&block)
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 77
def empty?
@set.nitems == 0
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 73
def size
@set.nitems
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 63
def to_a
@set.compact
end
No documentation available
#
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 67
def to_s
"[#{@set.compact.join(' ')}]"
end
No documentation available
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 38
def update(other)
s = @set
o = other.set
o.each_index do |idx|
if t = o[idx]
s[idx] = t
end
end
end
No documentation available
lib/racc/iset.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/racc/iset.rb, line 48
def update_a(a)
s = @set
a.each {|i| s[i.ident] = i }
end
No documentation available