From: Dave Thomas Date: 2000-03-16T10:53:29-06:00 Subject: [ruby-talk:01902] Re: Enumerations and all that. Hugh Sasse Staff Elec Eng writes: > Thank you to the people who responded to my questions about > Enumerated types. I have put something together that does what I > want now, and have some code to (not rigorously) test it. It may > have major weaknesses that I have not seen, so I would welcome > comments on it. I was wondering: if, rather than making each enumeration an instance, you were instead to define a new class for it (probably itself a subclass of Enumeration), then there'd be no need for the rest of the user-level code to keep an object reference lying around. You could say something like Enumeration.create("Colours", { RED => 1, GREEN => 2, ... }) and then elsewhere in the code simply reference Colours::RED Colours::GREEN and so on. If you wanted to go that route, the method Module#const_set would be useful. Regards Dave