On Sat, Jul 19, 2003 at 11:22:20PM +0900, Gavin Sinclair wrote:
> If Ruby had Array#to_h, then I could rewrite it as:

It does, almost:

irb(main):001:0> a = ["cat","one","dog","two"]
=> ["cat", "one", "dog", "two"]
irb(main):002:0> Hash[*a]
=> {"cat"=>"one", "dog"=>"two"}

I don't remember seeing an exact inverse of Hash#to_a though, i.e. one which
converts [[a,b],[c,d]] to {a=>b, c=>d}

You can always 'flatten' your array, as long as the elements of the hash
you're creating aren't themselves arrays.

Regards,

Brian.