[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01840] Re: enum examples?

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-03-15 14:42:38 UTC
List: ruby-talk #1840
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


In This Thread