Class: Economy::Rates::Base
- Inherits:
-
Object
- Object
- Economy::Rates::Base
- Defined in:
- lib/economy/rates/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#retries ⇒ Object
readonly
Returns the value of attribute retries.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/economy/rates/base.rb', line 7 def initialize @retries = 0 end |
Instance Attribute Details
#retries ⇒ Object (readonly)
Returns the value of attribute retries.
5 6 7 |
# File 'lib/economy/rates/base.rb', line 5 def retries @retries end |
Instance Method Details
#fetch ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/economy/rates/base.rb', line 11 def fetch begin call rescue if retries < 30 sleep 60 @retries += 1 fetch else puts "Giving up after #{retries} retries" end end end |