From: [email protected] [mailto:[email protected]] On
On Tue, 19 Dec 2006, Josselin wrote:
I understand how to sort an array with a single value but
how can I sort an
array w multiple values : [ integer_value1, float_value2]sorted_array = an_array.sort_by {|e| e[1] }
And if you want to sort by multiple values, in your own chosen order:
sorted_array = an_array.sort_by{ |e| [ e[1], e[0] ] }