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|
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.