class Money::Currency

def <=>(other_currency)

Returns:
  • (-1, 0, 1) - -1 if less than, 0 is equal to, 1 if greater than

Parameters:
  • other_currency (Money::Currency) -- The currency to compare to.
def <=>(other_currency)
  # <=> returns nil when one of the values is nil
  comparison = self.priority <=> other_currency.priority || 0
  if comparison == 0
    self.id <=> other_currency.id
  else
    comparison
  end
end