On 03.02.2007 19:52, Dan Stevens (IAmAI) wrote:
> As part of a solution, I wish the value of an attribute to be one of a
> finite set of values, in other words I believe I want an 'enumerated
> type'. I've look at the 'Enumerable' and 'Enumerator' class and they
> appear to me to be unrelated to what I wish to achieve (correct me if
> I'm wrong).
> 
> I could do the traditional method of named constants with integer
> values but I can't help feeling that there must be a class or some
> nice method of doing this. Any advice would be appreciated.

I believe there are enum classes in the RAA.  If you do not want to use 
them, symbols come pretty close:

class YourClass
   YOUR_ENUM = [
     :old,
     :young,
     :unknown,
   ].freeze
end

HTH

Kind regards

	robert