Skip to content

Commit

Permalink
Solve update_rates bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
phlegx committed Jul 4, 2017
1 parent 8260d28 commit 80a6345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/money/bank/currencylayer_bank.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ def ttl_in_seconds
# @return [Array] array of exchange rates
def update_rates(straight = false)
store.reset!
exchange_rates(straight).each do |exchange_rate|
rates = exchange_rates(straight).each do |exchange_rate|
currency = exchange_rate.first[3..-1]
rate = exchange_rate.last
next unless Money::Currency.find(currency)
add_rate(source, currency, rate)
add_rate(currency, source, 1.0 / rate)
end
@rates_mem_timestamp = rates_timestamp
rates
end

# Override Money `add_rate` method for caching
Expand Down
4 changes: 2 additions & 2 deletions money-currencylayer-bank.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'money-currencylayer-bank'
s.version = '0.5.5'
s.version = '0.5.6'
s.date = Time.now.utc.strftime('%Y-%m-%d')
s.homepage = "http://github.com/phlegx/#{s.name}"
s.authors = ['Egon Zemmer']
Expand All @@ -27,6 +27,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rr', '~> 1.1'
s.add_development_dependency 'rake', '~>12.0'
s.add_development_dependency 'timecop', '~>0.8.1'
s.add_development_dependency 'rubocop', '~>0.48.1'
s.add_development_dependency 'rubocop', '~>0.49.1'
s.add_development_dependency 'inch', '~>0.7.1'
end

0 comments on commit 80a6345

Please sign in to comment.