Class: Money
- Inherits:
-
Object
- Object
- Money
- Defined in:
- lib/counterfeit/money.rb
Overview
monkeypatching Money class to catch Money::Bank::UnknownRate error
Class Method Summary collapse
Instance Method Summary collapse
- #exchange_to_with_google(*args) ⇒ Object (also: #exchange_to)
Class Method Details
.google_to_the_rescue ⇒ Object
10 11 12 |
# File 'lib/counterfeit/money.rb', line 10 def self.google_to_the_rescue !google_saved_the_day && self.google_saved_the_day = true end |
Instance Method Details
#exchange_to_with_google(*args) ⇒ Object Also known as: exchange_to
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/counterfeit/money.rb', line 14 def exchange_to_with_google(*args) exchange_to_without_google(*args) rescue Money::Bank::UnknownRate => e if @bank == Money::Bank::VariableExchange.instance && self.class.google_to_the_rescue Money.default_bank = @bank = Money::Bank::GoogleCurrency.new retry else raise e end end |