On 04/03/2010 12:24 PM, Lucky Nl wrote:
> Hi , thankq to all,
> every solution is working
> 
> but the problem is am not getting in order means
> 
> getting result is
> {"w"=>["cie201"], "x"=>["i8"], "y"=>["i58", "i6", "v5"], "z"=>["ci5", 
> "i63"]}
> 
> but actual order of the elements placed is
> @results = [{"x"=>"i8"}, {"y"=>"i58"}, {"y"=>"i6"}, {"y"=>"v5"},
> {"z"=>"ci5"}, {"z"=>"i63"}, {"w"=>"cie201"}]
> 
>  so i want the order is
> 
> { "x"=>["i8"], "y"=>["i58", "i6", "v5"], "z"=>["ci5", 
> "i63"],"w"=>["cie201"]}

In Ruby 1.9 Hash maintains insertion order so you should get what you 
expect.  But generally hashes are not ordered.  If you want to enforce a 
particular ordering then you need to explicitly sort.

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/