Module: Coinage::Exchange::Base

Included in:
None, Variable, Xurrency, Yahoo
Defined in:
lib/coinage/exchange/base.rb

Instance Method Summary collapse

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_currenciesObject



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