sorting an array based on two attributes of objects

[ ['d',100], ['c',200], ['b',50], ['a',100] ].sort_by {|ns| [ ns.last, ns.first ]}
=> [["b", 50], ["a", 100], ["d", 100], ["c", 200]]

An array compares on its elements.

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com