I am trying to sort an array using a block but somehow I am not seeing
what I am want. First I want to sort the total, then break the tie on
gold goldcount, silvercount and finally on bronzcount

Here is my code. what am I missing? please help

  # compare and order by totals
        result = b[:total] <=> a[:total]
        # if tied, break the number of gold medals
        result != 0 ? result : b[:goldcount] <=> a[:goldcount]
        result != 0 ? result : b[:silvercount] <=> a[:silvercount]
        result != 0 ? result : b[:bronzcount] <=> a[:bronzcount]
        result != 0 ? result : b[:country] <=> a[:country]
  end
-- 
Posted via http://www.ruby-forum.com/.