class Kind::Enum::Item

Constants

Underscore

Attributes

inspect[R]
key[R]
name[R]
to_s[R]
to_str[R]
to_sym[R]
value[R]

Public Class Methods

new(key, val) click to toggle source
# File lib/kind/enum/item.rb, line 20
def initialize(key, val)
  @value = val.frozen? ? val : val.dup.freeze

  @to_s = Kind.respond_to(key, :to_sym).to_s
  @name = Underscore[key].upcase.freeze
  @to_sym = key.to_sym
  @inspect = ('#<Kind::Enum::Item name=%p to_s=%p value=%p>' % [@name, @to_s, @value]).freeze
end

Public Instance Methods

==(arg) click to toggle source
# File lib/kind/enum/item.rb, line 29
def ==(arg)
  arg == value || arg == to_s || arg == to_sym
end
Also aliased as: ===
===(arg)
Alias for: ==
to_ary() click to toggle source
# File lib/kind/enum/item.rb, line 33
def to_ary
  [key, value]
end