Module: Coinage::Exchange::Base
Instance Method Summary collapse
- #rate(current, target) ⇒ Object
- #supported_currencies ⇒ Object
- #validate_currency(*currencies) ⇒ Object (also: #validate_currencies)
Instance Method Details
#rate(current, target) ⇒ Object
5 6 7 |
# File 'lib/coinage/exchange/base.rb', line 5 def rate(current, target) validate_currencies(current, target) end |
#supported_currencies ⇒ Object
9 10 11 |
# File 'lib/coinage/exchange/base.rb', line 9 def supported_currencies [:usd, :aud, :sgd] end |
#validate_currency(*currencies) ⇒ Object Also known as: validate_currencies
13 14 15 16 17 |
# File 'lib/coinage/exchange/base.rb', line 13 def validate_currency(*currencies) currencies.each do |currency| raise ArgumentError unless supported_currencies.include?(currency) end end |