From: James Coglan Date: 2008-11-20T00:52:30+09:00 Subject: Re: build hash by iterating ------=_Part_39756_23858225.1227109642489 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline > > h = {} > i = 0 > j = 24 > > while i < 15 do > h[i] = j > i += 1 > j += 6 > end h = (0...15).inject({}) do |m,i| m[i] = 24 + i * 6 m end this is not working: new_hash = h.each_key {|k| h[k].to_s} new_hash = h.inject({}) { |m,p| m[p[0].to_s] = p[1]; m } ------=_Part_39756_23858225.1227109642489--