From: kevin peter Date: 2011-08-19T15:46:28+09:00 Subject: Sorting Ruby hash by value and stored the result in hash. Hi I have problem in storing the sorted hash result in hash again. for example hash = {:a => 10, :b => 5, :c => 20, :d => 15 } I have applied sorting as below using sort_by hash.sort_by{|key,value| value } => [[:b, 5], [:a, 10], [:d, 15], [:c, 20]] So here values are sorted but result is in array format. How to build hash from this array as below? i.e sorting by value ? {:b => 5, :a => 10, :d => 15, :c => 20} Thanks in advance -- Posted via http://www.ruby-forum.com/.