Sha256: 9586e3f6e2f3f9a2f2c592c1bff2688d3d1f8067d51cb580ea8743f1c3099eb2

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

module Money::RatesStore
  module RateRemovalSupport
    # Remove a conversion rate and returns it. Uses +Mutex+ to synchronize data access.
    #
    # @param [String] currency_iso_from Currency to exchange from.
    # @param [String] currency_iso_to Currency to exchange to.
    #
    # @return [Numeric]
    #
    # @example
    #   store = Money::RatesStore::Memory.new
    #   store.remove_rate("USD", "CAD")
    #   store.remove_rate("CAD", "USD")
    def remove_rate(currency_iso_from, currency_iso_to)
      transaction { index.delete rate_key_for(currency_iso_from, currency_iso_to) }
    end

    # Clears all conversion rates. Uses +Mutex+ to synchronize data access.
    #
    # @example
    #   store = Money::RatesStore::Memory.new
    #   store.clear_rates
    def clear_rates
      transaction { @index = {} }
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
fixer_currency-3.4.3 lib/money/rates_store/rate_removal_support.rb
fixer_currency-3.4.2 lib/money/rates_store/rate_removal_support.rb
google_currency-3.4.1 lib/money/rates_store/rate_removal_support.rb
google_currency-3.4.0 lib/money/rates_store/rate_removal_support.rb
xe_currency-0.0.1 lib/money/rates_store/rate_removal_support.rb
google_currency-3.3.0 lib/money/rates_store/rate_removal_support.rb