Parent

Included Modules

Enumerize::Set

Attributes

values[R]

Public Class Methods

new(obj, attr, values) click to toggle source
# File lib/enumerize/set.rb, line 8
def initialize(obj, attr, values)
  @obj    = obj
  @attr   = attr
  @values = ::Set.new

  if values.respond_to?(:each)
    values.each do |input|
      value = @attr.find_value(input)
      @values << value if value
    end
  end
end

Public Instance Methods

<<(value) click to toggle source
# File lib/enumerize/set.rb, line 21
def <<(value)
  @values << value
  mutate!
end
Also aliased as: push
==(other) click to toggle source
# File lib/enumerize/set.rb, line 36
def ==(other)
  other.size == size && other.all? { |v| @values.include?(@attr.find_value(v)) }
end
Also aliased as: eql?
delete(value) click to toggle source
# File lib/enumerize/set.rb, line 46
def delete(value)
  @values.delete(@attr.find_value(value))
  mutate!
end
eql?(other) click to toggle source
Alias for: ==
include?(value) click to toggle source
# File lib/enumerize/set.rb, line 42
def include?(value)
  @values.include?(@attr.find_value(value))
end
inspect() click to toggle source
# File lib/enumerize/set.rb, line 51
def inspect
  "#<Enumerize::Set {#{join(', ')}}>"
end
push(value) click to toggle source
Alias for: <<
to_ary() click to toggle source
# File lib/enumerize/set.rb, line 30
def to_ary
  @values.to_a
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.