Alex:

Ah-ha! Thanks for getting me on the right track.

Couple of points (for others following along...)

> You can get away with just using an Array for almost all of this.
>
> a = [{:a => 1, :b => 2}, {:c => 4, :d => 5}]
> a[1] # => {:c=>4, :d=>5}
> a << {:e => 6, :f => 7}
> # => [{:b=>2, :a=>1}, {:c=>4, :d=>5}, {:e=>6, :f=>7}]
> a.select {|x| x[:c] == 4} # => [{:c=>4, :d=>5}]
>
> b = [1,2,3,4]
> b.insert(2,5) # => [1, 2, 5, 3, 4]

Now THAT's the set of examples I needed, and that should be in the major 
Ruby docs.

And I'd add Array#delete

(... though I'm not yet clear on the sematics.  Does this simply remove the 
object from the array, or also delete it's data? Ie: if there's another 
reference to this object, is the data still there? To be tested...)

>> [...Ruby for Rail's Collection chapter's description of "insert"...]
> If so, that's simply wrong.

Yep, so it seems!

PickAxe's "Containers" etc chapter manages to get us all the way to lambda 
functions and closures, but its "SongList" example is too simple to be as 
useful as your examples above.

Meanwhile, Ruby for Rails' "Collections, containers" etc chapter says the 
following (emphasis mine):

-----------------------------
11.2.2 Inserting, retrieving and removing array elements
Because an array is an ordered collection, any object you add to the array 
goes either at the beginning, at the end, or somewhere in the middle. The 
most general technique for INSERTING one or more items into an array is the 
setter method []= (square brackets...
-----------------------------

... and goes on to give "insert" examples which do not insert, they simply 
assign to an array slot.  (And there's no mention of the insert method). So 
I had written off array as being the complete answer, since its supposed 
insert syntax "obviously" didn't really know how to insert.

Now that you've pointed out that there's an insert method called, ahem, 
"insert", I see that it actually IS the array class that handles Collection 
duty, and I can focus there for some more serious RTFM-ing.

Thanks again for the quick clarification!

Graham

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