From: "Peña, Botp" Date: 2004-04-24T15:31:40+09:00 Subject: Re: Array to Hash > simply amazing solution fr the humble Nobu. > Now, I can do: > > module Enumerable > def to_h > inject({}) {|h, (k, v)| h[k] = v; h} > end > end > ==>nil > h = {"x"=>1,"y"=>2} > ==>{"x"=>1, "y"=>2} > a = h.to_a > ==>[["x", 1], ["y", 2]] > h2 = a.to_h > ==>{"x"=>1, "y"=>2} sorry, the last lines were cut-off by my window h = h.to_a.to_h ==>{"x"=>1, "y"=>2} a = a.to_h.to_a ==>[["x", 1], ["y", 2]] > > Now _that_ is Ruby. > > > -- > > Nobu Nakada > > thank you and > kind regards -botp >