From: Florian Frank Date: 2002-11-28T05:00:12+09:00 Subject: Re: Sort by hash element On Wed, 2002-11-27 at 11:54, Tim Bates wrote: > Is there an easy, Ruby-idiomatic way to sort this array by the 'score' > elements of each hash? eg so I get In Ruby 1.7x you could use the nice Array#sort_by: a = [...] a.sort_by { |x| x["score"] } ==>[{"score"=>7, "name"=>"Bryce"}, {"score"=>9, "name"=>"Chris"}, {"score"=>11, "name"=>"Anna"}]