On Thu, Aug 28, 2008 at 1:39 PM, Joshua Muheim <forum / josh.ch> wrote: > I have a array of some objects: > > [obj1, obj2, obj3, obj4] > > All objects have a method "status" that returns a status object, like > "open", "request", "cancelled", "completed" etc. > > Now I'd like to sort the elements after theses statuses into a new hash, > so in the end it should look something like this: > > {status1 => [obj1, obj3], > status3 => [obj2], > status4 => [obj4]} If working with a Set is fine (there's #to_set) that's provided by Set#classify.