Method: Money::Bank::ECB#reload
- Defined in:
- lib/money/bank/ecb.rb
#reload ⇒ self
Load rates from the cache file.
Be “loose” to accommodate for future changes in list of currencies etc.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/money/bank/ecb.rb', line 142 def reload time, quotations = cache_content @mutex.synchronize do @rates_date = time @currencies = quotations.map{|key, _| key} quotations.each do |currency, rate| set_rate('EUR', currency, rate, :without_mutex => true) set_rate(currency, 'EUR', 1/rate, :without_mutex => true) end quotations.product(quotations) do |one, another| one_cur, one_rate = one another_cur, another_rate = another next if one_cur == another_cur set_rate(one_cur, another_cur, another_rate/one_rate, :without_mutex => true) end end self end |