From: "Peña, Botp" Date: 2007-10-22T12:21:31+09:00 Subject: Re: What's the ruby way of grouping elements of an array? On Behalf Of Sam Kong: # people.group_by do |person| # person.age # end # The above method should return an array of arrays # grouped by age. What's the ruby way for this case? # I think I can implement it but I am sure that a good # way already exists. as you've said (and as others have offered), you'll have to implement it or use another lib/gem. if you can wait for ruby2 (or use 1.9), the group_by and symbol's to_proc is a good combi. eg, > people.group_by{|person| person.age} ... or > people.group_by(& :age) ... > RUBY_VERSION => "1.9.0" btw, group_by returns hash of arrays kind regards -botp