From: Brian Candler Date: 2008-09-22T04:48:53+09:00 Subject: Re: iterating methods on multiple parameters Jason Lillywhite wrote: > I just saw a similar issue (#163350 of this forum). > > seems like this might work to change values of a hash: > > hash = {'x'=>2, 'y'=5} > hash_new = hash.inject({}) do |h, (k,v)| > h[v * 2] = k > h > end > > although this returns {10=>"y", 4=>"x"} > > something seems amiss... hash = {'x'=>2, 'y'=>5} hash_new = hash.inject({}) do |h, (k,v)| h[k] = v * 2 h end -- Posted via http://www.ruby-forum.com/.