On Jan 21, 2008, at 12:23 PM, Max Williams wrote:

> I have a collection of objects, which i want to separate into groups
> based on a particular property (to be specific, two attributes -  
> that is
> if obj.foo and obj.bar are both the same for two objects they go  
> into an
> array together).  Not every object has a duplicate, but most of them  
> do.
> So, i'd end up with an array, where each member is another array, with
> the subarrays holding either 1 or 2 (or maybe more) objects that match
> on foo and bar.
>
> Can anyone tell me a nice and simple way of doing this?

Enumerable#parition or Set#classify might help.

-- fxn