Class: Money

Inherits:
Object
  • Object
show all
Defined in:
lib/money/bank/historical.rb,
lib/money/rates_store/historical_redis.rb,
lib/money/rates_provider/open_exchange_rates.rb

Defined Under Namespace

Modules: Bank, RatesProvider, RatesStore

Instance Method Summary collapse

Instance Method Details

#exchange_to_historical(other_currency, datetime, &rounding_method) ⇒ Object

Exchanges to other_currency using datetime‘s closing rates and returns a new Money object. rounding_method is ignored in this version of the gem.

Parameters

  • other_currency - The currency to exchange to. Accepts ISO String and Money::Currency objects.

  • datetime - The Date to get the exchange rate from. If Time is passed instead, it’s converted to the UTC Date.

  • rounding_method - This parameter is ignored in this version of the gem.



342
343
344
345
# File 'lib/money/bank/historical.rb', line 342

def exchange_to_historical(other_currency, datetime, &rounding_method)
  Bank::Historical.instance.exchange_with_historical(self, other_currency,
                                                     datetime, &rounding_method)
end