Skip to content

Commit f14e96a

Browse files
committed
Call exchange_rates one time
1 parent 3440c43 commit f14e96a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/money/distributed/fetcher/base.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ def initialize(bank = nil)
1010
end
1111

1212
def fetch
13-
currencies = exchange_rates.keys
13+
rates = exchange_rates
14+
currencies = rates.keys
1415

1516
currencies.each { |cur| add_rate(cur, cur, 1) }
1617

1718
currencies.combination(2).each do |curr1, curr2|
18-
rate = exchange_rates[curr2] / exchange_rates[curr1]
19+
rate = rates[curr2] / rates[curr1]
1920
add_rate(curr1, curr2, rate)
2021
end
2122
end

lib/money/distributed/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Money
22
module Distributed
3-
VERSION = '0.0.1'.freeze
3+
VERSION = '0.0.2'.freeze
44
end
55
end

0 commit comments

Comments
 (0)