hey guys,
got an array question:
class Autos
with a variable name
I have an array of Autos. I want to split this array into chunks of
arrays grouped by name.
ie, Autos = [{id:1, name:toyota}, {id:2, name:ford}, {id:3,
name:toyota} ]
would create two arrays in a super array
[ [{id:1, name:toyota},{id:3, name:toyota}] , [{id:2, name:ford:}] ]
i have the unique list of names.
I was roughly thinking of sorting the array by name and finding the
first occurrence of each name and doing a slice.
Is there a faster approach?
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---