lib/currencies/currency.rb in currencies-0.4.1 vs lib/currencies/currency.rb in currencies-0.4.2
- old
+ new
@@ -27,10 +27,10 @@
@exchange_rate = nil unless @exchange_currency == self.class.base_currency
@exchange_rate ||= load_exchange_rate
end
def load_exchange_rate
- @exchange_currency = self.class.base_currency
+ @exchange_currency = self.class.base_currency unless @exchange_currency
return 1.0 if @code == @exchange_currency
if self.class.import_exchange_rates
http = Net::HTTP.new('download.finance.yahoo.com', 80)
response = http.get("/d/quotes.csv?e=.csv&f=sl1d1t1&s=#{@code}#{@exchange_currency}=X")
rate = response.body.split(',')[1]