Skip to content

Instantly share code, notes, and snippets.

@pechorin
Created September 16, 2015 17:45
Show Gist options
  • Save pechorin/9a196ba2536e81c75b38 to your computer and use it in GitHub Desktop.
Save pechorin/9a196ba2536e81c75b38 to your computer and use it in GitHub Desktop.
def self.force_refetch!(&block)
is_feched = false
while is_feched == false
begin
RcbBank.set!
RcbBank.fetch_rates!
RcbBank.store_rates
is_feched = true
if block_given?
yield RcbBank.rates_updated_on, RcbBank.rates
end
rescue Money::Bank::RussianCentralBank::FetchError => e
puts "retrying because of #{e}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment