From: Arlen Cuss Date: 2012-10-20T13:31:16+09:00 Subject: Re: Hash with Integer key issue Note that "Hash[arr]" works too! On Saturday, 20 October 2012 at 2:27 PM, Harry Kakueki wrote: > > # And here is the problem! Now that I am looking at it here, it's > > obvious that the sort is flattening the Hash... Is there a way to > > restore it to a Hash, or a better way to achieve the sort? > > > > irb(main):033:0> x[46] > > => [3, 1] > > > > Does this help? > > arr = [[49, 47], [48, 46], [47, 45], [46, 44], [45, 43], [44, 42]] > p Hash[*arr.flatten] > > #> {49=>47, 48=>46, 47=>45, 46=>44, 45=>43, 44=>42} > > > > > Harry