Closed knleva closed 9 years ago
I am not having this issue. Are you using the ‘master’ branch from GitHub?
On Thu, Aug 13, 2015 at 6:16 AM, knleva notifications@github.com wrote:
Hi, Just trying google_currency and attempting to run a simple test detailed in "Usage": require 'money' require 'money/bank/google_currency' Money.default_bank = Money::Bank::GoogleCurrency.new money = Money.new(1_00, "USD") money.exchange_to(:EUR) The exchnage_to operation fails with: NoMethodError: undefined method
synchronize' for nil:NilClass from /Users/knleva/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/google_currency-3.1.0/lib/money/bank/google_currency.rb:98:in
get_rate' Here is the routine that fails: def get_rate(from, to) expire_rates @mutex.synchronize{ @rates[rate_key_for(from, to)] ||= fetch_rate(from, to) } end Tried googling, but can't find anything definitive on how to fix this. Would appreciate a tip. Thanks,Lev
Reply to this email directly or view it on GitHub: https://github.com/RubyMoney/google_currency/issues/43
That has been fixed in this pull request: https://github.com/RubyMoney/google_currency/pull/42/files#diff-4a738c34f40d03c9a55be349edf8e379L103
Thanks @more-ron, I will try again. Perhaps I didn't have the latest version of the gem somehow.
Hi,
Just trying google_currency and attempting to run a simple test detailed in "Usage": require 'money' require 'money/bank/google_currency' Money.default_bank = Money::Bank::GoogleCurrency.new money = Money.new(1_00, "USD") money.exchange_to(:EUR)
The exchnage_to operation fails with: NoMethodError: undefined method 'synchronize' for nil:NilClass from /Users/knleva/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/google_currency-3.1.0/lib/money/bank/google_currency.rb:98:in `get_rate'
Here is the routine that fails: def get_rate(from, to) expire_rates @mutex.synchronize{ @rates[rate_key_for(from, to)] ||= fetch_rate(from, to) } end
Tried googling, but can't find anything definitive on how to fix this. Would appreciate a tip.
Thanks, Lev