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

Defined in:

money/currency/rate_store/memory.cr

Instance Method Summary

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

[](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 : Nil clear, each(& : Rate -> _) : Nil each, transaction(& : -> _) transaction

Instance Method Detail

def transaction(& : -> _) #
Description copied from class Money::Currency::RateStore

Wraps block execution in a concurrency-safe transaction.


[View source]