From: "Ara.T.Howard" Date: 2004-04-24T14:14:05+09:00 Subject: Re: Array to Hash On Sat, 24 Apr 2004 nobu.nokada@softhome.net wrote: > Hi, > > At Sat, 24 Apr 2004 13:05:20 +0900, > Pe�a, Botp wrote in [ruby-talk:98203]: > > I would rather prefer: > > > > >> h2 = a.to_hash # or a.to_h > > {"x"=>1, "y"=>3} > > module Enumerable > def to_h > inject({}) {|h, (k, v)| h[k] = v; h} ^^^^^^ ^^^^^^ ^^^^^^ what's this? > end > end > > -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================