Module: Monee::Comparison
Overview
modularizing the comparison of money objects method in a separate module
Instance Method Summary collapse
-
#<=>(other) ⇒ Boolean
this is the spaceship operator overriding, this will take care of >, <, ==.
Instance Method Details
#<=>(other) ⇒ Boolean
this is the spaceship operator overriding, this will take care of >, <, ==
10 11 12 13 14 15 16 |
# 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 |