Class: Money::Bank::SingleCurrency
- Defined in:
- lib/money/bank/single_currency.rb,
sig/lib/money/bank/single_currency.rbs
Overview
Class to ensure client code is operating in a single currency by raising if an exchange attempts to happen.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#exchange_with(from, to_currency) ⇒ void
Raises a DifferentCurrencyError to remove possibility of accidentally exchanging currencies.
Methods inherited from Base
#initialize, instance, #same_currency?, #setup
Constructor Details
This class inherits a constructor from Money::Bank::Base
Instance Method Details
#exchange_with(from, to_currency) ⇒ void
This method returns an undefined value.
Raises a DifferentCurrencyError to remove possibility of accidentally exchanging currencies
20 21 22 |
# File 'lib/money/bank/single_currency.rb', line 20 def exchange_with(from, to_currency, &) raise DifferentCurrencyError, "No exchanging of currencies allowed: #{from} #{from.currency} to #{to_currency}" end |