Module: Money::RatesStore::RateRemovalSupport

Defined in:
lib/money/rates_store/rate_removal_support.rb

Instance Method Summary collapse

Instance Method Details

#clear_ratesObject

Clears all conversion rates. Uses Mutex to synchronize data access.

Examples:

store = Money::RatesStore::Memory.new
store.clear_rates


23
24
25
# File 'lib/money/rates_store/rate_removal_support.rb', line 23

def clear_rates
  transaction { @index = {} }
end

#remove_rate(currency_iso_from, currency_iso_to) ⇒ Numeric

Remove a conversion rate and returns it. Uses Mutex to synchronize data access.

Examples:

store = Money::RatesStore::Memory.new
store.remove_rate("USD", "CAD")
store.remove_rate("CAD", "USD")


14
15
16
# File 'lib/money/rates_store/rate_removal_support.rb', line 14

def remove_rate(currency_iso_from, currency_iso_to)
  transaction { index.delete rate_key_for(currency_iso_from, currency_iso_to) }
end