From: Sam Kong Date: 2007-10-20T04:01:20+09:00 Subject: What's the ruby way of grouping elements of an array? Hi, I thought this would be a common need but I couldn't find a method. Let's say I have an array of objects. I want to group the elements by a property of objects. 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. Thanks. Sam -- Posted via http://www.ruby-forum.com/.