lib/danconia/money.rb in danconia-0.2.6 vs lib/danconia/money.rb in danconia-0.2.7
- old
+ new
@@ -45,17 +45,11 @@
amount <=> other
end
def exchange_to other_currency
other_currency = other_currency.presence && Currency.find(other_currency, exchange) || currency
- rate = exchange_rate_to(other_currency.code)
+ rate = exchange.rate currency.code, other_currency.code
clone_with amount * rate, other_currency
- end
-
- def exchange_rate_to to
- from = currency.code
- return 1 if from == to
- exchange.rate from, to
end
%w(+ - * /).each do |op|
class_eval <<-EOR, __FILE__, __LINE__ + 1
def #{op} other