class Enum < Object
E = Enum[:B, :C, :D] F = Enum.new(:A, :B, :C, 10, :D)
p E::C.type #=> EnumTest::E p E::C.to_s #=> C p E::C.to_i #=> 1
p F::D.type #=> EnumTest::F p F::D.to_s #=> D p F::D.to_i #=> 10
class Element < Object
Create a new Enum::Element; only used internally.
Retrieve the value of this element (which is usually an integer).
Returns: the value of this element.
Convert this element to a string.
Returns: a string containing the name of this element.
value is an alias for to_i.
name is an alias for to_s.
Compare this element to another element.
Returns: 0 if both elements are the same type and have the same type, -1 if this element is determined to be less than the other element, or 1 if this element is determined to be greater than the other element.
Iterate through all the Enum Elements in a customer in order.
Returns: the last value from the last call to yield.
Checks to see whether a lookup table has been created yet, creates it if it hasn't been, and returns the lookup table. The lookup table matches a value (usually Fixnum) to an Enum Element.
Returns: a lookup table for this Enum type.
A synonym for Enum.new
Create a new Enum type
|args||a list of arguments representing the possible values for this Enum type|
Returns: a new class (a customer, see below) that derives from Enum::Element representing the new Enum type.
class customer < Element
Construct an Enum Element from a Fixnum (or whatever value type we are using) or a name or a string (or anything else that has a to_s function that generates a valid constant).
Returns: a new Enum Element.