From: Robert Klemme Date: 2012-06-21T15:20:28+09:00 Subject: Re: Benchmark obsession? On Thu, Jun 21, 2012 at 6:28 AM, Avdi Grimm wrote: > On Wed, Jun 20, 2012 at 9:07 PM, Sam Duncan wrote: >> >> Is that basically the same thing wrapped in another method so that counter >> and o are yielded to a block? > > Yes, and it's part of > Enumerable: http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-each_with_object Enumerable also has http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-group_by thingies.group_by(&:key) thingies.group_by(&:key).map {|o,y| [o,y.length]} Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/