class Money::Currency::RateStore::Memory

Overview

Class for concurrency-safe storage of exchange rate pairs. Used by instances of Currency::VariableExchange.

store = Money::Currency::RateStore::Memory.new
store["USD", "CAD"] = 0.98
store["USD", "CAD"] # => 0.98

# Iterates rates
store.each do |rate|
  puts rate
end

Direct Known Subclasses

Defined in:

money/currency/rate_store/memory.cr

Instance methods inherited from class Money::Currency::RateStore

<<(rate : Rate) : self
<<(rates : Enumerable(Rate)) : self
<<
, [](from : String | Symbol | Currency, to : String | Symbol | Currency) : BigDecimal [], []=(from : String | Symbol | Currency, to : String | Symbol | Currency, value : Number) : Nil []=, []?(from : String | Symbol | Currency, to : String | Symbol | Currency) : BigDecimal | Nil []?, clear(base_currency : String | Symbol | Currency) : Nil
clear : Nil
clear
, each(& : Rate -> _) : Nil each, rates : Array(Rate) rates, transaction(*, mutable : Bool = false, & : -> _) transaction

Constructor methods inherited from class Money::Currency::RateStore

new(ttl : Time::Span | Nil = nil) new