Method: Money::RatesStore::Memory#each_rate

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

#each_rate {|iso_from, iso_to, rate| ... } ⇒ Enumerator

Iterate over rate tuples (iso_from, iso_to, rate)

Examples:

store.each_rate do |iso_from, iso_to, rate|
  puts [iso_from, iso_to, rate].join
end

Yield Parameters:

  • iso_from (String)

    Currency ISO string.

  • iso_to (String)

    Currency ISO string.

  • rate (Numeric)

    Exchange rate.

Returns:

  • (Enumerator)


93
94
95
96
97
98
99
100
101
102
# File 'lib/money/rates_store/memory.rb', line 93

def each_rate(&block)
  return to_enum(:each_rate) unless block_given?

  guard.synchronize do
    rates.each do |key, rate|
      iso_from, iso_to = key.split(INDEX_KEY_SEPARATOR)
      yield iso_from, iso_to, rate
    end
  end
end