class MetaEnum::Element

Attributes

data[R]
name[R]
type[R]
value[R]

Public Class Methods

new(value, name, data, type) click to toggle source
# File lib/meta_enum/element.rb, line 5
def initialize(value, name, data, type)
  @value = value
  @name = name.to_sym
  @data = data
  @type = type
  freeze
end

Public Instance Methods

==(other) click to toggle source
# File lib/meta_enum/element.rb, line 13
def ==(other)
  equal?(other) || equal?(type[other])

# type[] will raise for certain bad keys. Those are obviously not equal so return false.
rescue ArgumentError, KeyError
  false
end
inspect() click to toggle source
# File lib/meta_enum/element.rb, line 23
def inspect
  "#<#{self.class}: #{name}: #{value.inspect}, data: #{data.inspect}>"
end
to_s() click to toggle source
# File lib/meta_enum/element.rb, line 21
def to_s; name.to_s; end