module
Money::Exchange
Direct including types
Defined in:
money/money/exchange.crInstance Method Summary
-
#exchange_to(other_currency : String | Symbol | Currency) : Money
Exchanges
self
to a newMoney
object in other_currency. -
#with_same_currency(other : Money, &)
Yields other
Money
object exchanged toself.currency
.
Instance Method Detail
Exchanges self
to a new Money
object in other_currency.
Money.default_exchange.rate_store["USD", "EUR"] = 1.23
Money.default_exchange.rate_store["EUR", "USD"] = 0.82
Money.new(1_00, "USD").exchange_to("EUR") # => Money(@amount=1.23, @currency="EUR")
Money.new(1_00, "EUR").exchange_to("USD") # => Money(@amount=0.82, @currency="USD")
Yields other Money
object exchanged to self.currency
.