From: Brian Takita Date: 2005-08-26T04:11:39+09:00 Subject: Re: Win32ole object collection mapping to array ? ------=_Part_6061_9944935.1124997093782 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry. What I gave you is wrong. Daniel has a good solution. On 8/25/05, Brian Takita wrote: >=20 > Try this... >=20 > > items =3D [] > > oleItems.each {|o| items << {o.Name =3D> o} } > > items.sort {|x, y| x.Name <=3D> y.Name} >=20 > On 8/25/05, Peter Fitzgibbons =20 > wrote: > >=20 > > Hello all, > >=20 > > I have a win32ole object collection that I want to map, then sort, to a= n=20 > >=20 > > array? > >=20 > > Each item has #Name property. I'm thinking of making an arry of hashes > > a'la : > >=20 > > > items =3D [] > > > oleItems.each {|o| items << {o.Name =3D> o} } > > > items > > [{"0172"=3D>#}, {"0171"=3D>#}]= =20 > >=20 > > But then, how do I sort the array of hashes ? > >=20 > > Is there a better approach ? > >=20 > > Peter J. Fitzgibbons > > Applications Manager > > Lakewood Homes - "The American Dream Builder"(r) > > Peter.Fitzgibbons@Lakewoodhomes.net > > (847) 884-8800 > >=20 > >=20 > >=20 > >=20 > ------=_Part_6061_9944935.1124997093782--