Folks:

I'm new to Ruby, though not to programming in general. So I'm looking around 
for some of the mechanisms I'm used to finding, and one of them is an 
apparatus for Collections (as for example used in C++, OP, VB etc).

I'm hoping that someone can point me in the right direction as to where this 
functionality can be found, or failing that suggest the most advantageous 
starting point to create it based on more primitive classes.

Main features:

1. The contained objects are user-defined types having multiple fields (data 
members). This in itself seems no problem for Ruby.

2. Order/Retrieve by index. The collection should stay ordered by insertion 
order and support retrieval by integer index. (Sorted collection is a 
separate issue, of course.)

3. Insert/Append/Remove/Delete. (List behavior) Allow appending (at end) or 
inserting at arbitrary location, and removal or deletion of arbitrary 
members.

4. Find by key: (Dictionary behavior etc) Ability to retrieve member objects 
by supplying a value to match against one of the object's fields. Often this 
is simple a Name field on each object, which functions as a key, but at 
other times one might want lookup based on some other field or fields.

So far I've read plenty that seems related: arrays, hashes, Enumerable, and 
several related chapters in PickAxe and Ruby for Rails. Although 
"collections" are mentioned in many of these sources, I've not yet hit on a 
treatment of the ruby way for the Collection basics described above (eg: R 
on R's Collection chapter's description of "insert"  is simply replacing the 
Nth element of an array).

Needless to say, I'd much appreciate comments illuminating this area!

Thanks

Graham

---------------------------------------------------
Graham Wideman
Microsoft Visio MVP
---------------------------------------------------
Book/Tools:
Visio 2003 Developer's Survival Pack
Resources for programmable diagramming at:
http://www.diagramantics.com