From: "David A. Black" Date: 2009-10-02T09:37:55+09:00 Subject: Re: how do you do this Hi -- On Fri, 2 Oct 2009, Tony Arcieri wrote: > On Thu, Oct 1, 2009 at 6:38 AM, Paul Smith wrote: > >> >> Must.... master..... inject..... >> > > I think it's much more readable to build hashes with something like: > > h = {} > blah.each do |v| > h[...] = ... > end > > than: > > blah.inject({}) do |h, v| > h[...] = ... > h > end I agree, and I think that's it's nice that 1.9 provides Enumerator#with_object, which lets you avoid that explicit feeding of the accumulator back into the loop. David -- David A. Black, Director Ruby Power and Light, LLC (http://www.rubypal.com) Ruby/Rails training, consulting, mentoring, code review Book: The Well-Grounded Rubyist (http://www.manning.com/black2)