module Monee::Comparison
modularizing the comparison of money objects method in a separate module
Public Instance Methods
<=>(other)
click to toggle source
this is the spaceship operator overriding, this will take care of >, <, ==
@params other [Money, Numeric] @return [Boolean]
# File lib/monee/comparison.rb, line 10 def <=>(other) if currency == other.currency cents <=> other.cents else cents <=> other.convert_to_cents(currency) end end