From: Meino Christian Cramer Date: 2004-07-05T16:19:20+09:00 Subject: Re: Transforming... From: "Gavin Sinclair" Subject: Re: Transforming... Date: Mon, 5 Jul 2004 16:07:19 +0900 Hi Gavin, whow! what a fast reply ! Thank you very much ! :) I want an algorithm, which when applied like this b= it does the same as I would do this by hand: b=[[,,],[,,],[,,]] > Meino wrote: > > > In my program there is a hash of this form > > > > a={ "" => [,,], > > "" => [,,], > > "" => [,,] > > } > > > > I am looking for a short and handy way to produce an array out of > > this, which looks like: > > > > b=[[,,],[,,],[,,]] > > > > without iterating over the hash. > > I presume you mean you just want an array of the *values* in the hash? > > b = a.values > > If you want the values sorted according to the order of the keys: > > b = a.keys.sort.map { |k| a[k] } > > Cheers, > Gavin > > > > >