Module: ForeignCurrencyExchange::Money::Configuration

Included in:
ForeignCurrencyExchange::Money
Defined in:
lib/foreign_currency_exchange/money/configuration.rb

Overview

This module contains configuration methods for Money class

Constant Summary collapse

BASE_CURRENCY_RATE =
1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_currencyObject (readonly)

Returns the value of attribute base_currency.



7
8
9
# File 'lib/foreign_currency_exchange/money/configuration.rb', line 7

def base_currency
  @base_currency
end

#ratesObject (readonly)

Returns the value of attribute rates.



7
8
9
# File 'lib/foreign_currency_exchange/money/configuration.rb', line 7

def rates
  @rates
end

Instance Method Details

#check_configurationObject



18
19
20
21
# File 'lib/foreign_currency_exchange/money/configuration.rb', line 18

def check_configuration
  check_rates
  check_base_currency_rate
end

#conversion_rates(base_currency, rates) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/foreign_currency_exchange/money/configuration.rb', line 9

def conversion_rates(base_currency, rates)
  @rates = rates
  @base_currency = base_currency
  check_configuration
rescue => exception
  nullify_configuration
  raise exception
end