On Fri, Jul 1, 2011 at 1:22 PM, Iñáki Baz Castillo <ibc / aliax.net> wrote: > 2011/7/1 Robert Klemme <shortcutter / googlemail.com>: >> array.sort_by {|e| [e.a, e.b]} > > Note that entries must be ordered by smaller :a and, in case of same > :a, by higher :b. So the last "e.b" should be changed to something > else. Trying it right now. Oh, my mistake. I am sorry. So that would be (for numeric b): array.sort_by {|e| [e.a, -e.b]} And then KK = Struct.new :a,:b do include Comparable def <=>(o) cmp = a <=> o.a cmp == 0 ? o.b <=> b : cmp end end Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/