class Money::Currency::RateStore::Memory

Overview

Class for in-memory concurrency-safe storage of exchange rate pairs.

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

Constructors

Class Method Summary

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

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

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

new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
new(pull : JSON::PullParser)
new(*, ttl : Time::Span | Nil = nil)
new

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

find(name : String | Symbol) : Money::Currency::RateStore.class find, find?(name : String | Symbol) : Money::Currency::RateStore.class | Nil find?, registry registry

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

Class for in-memory concurrency-safe storage of exchange rate pairs.

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

[View source]
def self.new(pull : JSON::PullParser) #

Class for in-memory concurrency-safe storage of exchange rate pairs.

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

[View source]

Class Method Detail

def self.key : String #

Returns the class key.


[View source]