On Wed, 15 Mar 2000, Yukihiro Matsumoto wrote: > Hi, > > In message "[ruby-talk:01834] enum examples?" > on 00/03/15, Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes: > > |Has anyone any examplse of using the Enumerable module? I've had a > |look around, but not found much. > > What kind of examples you have in mind? > > Array class is a example. Enumerable module add set of methods > depending on `each', among which are `collect', `detect', `sort', > etc. to a including class. I was at cross purposes then. I was thinking of enumerated types as in Pascal and C++. > > | I'm thinking of something to allow > |me to have names for bits in a flag field, so I can test if one or > |more is set. I could create my own object for this, of course, but > |why re-invent unless I must? > > Hmm, names for bits..., I'm afraid there's no direct class for that > purpose in Ruby. But it's easy for define such class. > [nice example trimmed] > > Re-inventing wheel is fun using Ruby. :-) > Yes, that looks the sort of thing I want. I will take this and modify it a bit, and let you know how I get on. Thank you. > matz. > Hugh hgs / dmu.ac.uk