From: Xavier Noria Date: 2007-07-08T18:52:36+09:00 Subject: Re: simple array question El Jul 8, 2007, a las 11:28 AM, Shai Rosenfeld escribi�: > a = Module.new(:att1 => 1, :att2 => "abc") > b = Module.new(:att1 => 1, :att2 => "adfbc") > c = Module.new(:att1 => 2, :att2 => "abcasdf") > d = Module.new(:att1 => 1, :att2 => "ddddf") > e = Module.new(:att1 => 2, :att2 => "ddddf") > f = Module.new(:att1 => 3, :att2 => "ddddf") > > array = [a,b,c,d,e,f] > > # i want to take the 'array' var and make it into seperate arrays > according to the att1 attribute, i.e, resulting in the example > above to > > r1=[a,b,d] > r2=[c,e] > r3=[f] > > any nice way to do this? I would delegate the job to Set#classify. -- fxn