Module: AttemptThis
- Extended by:
- AttemptThis
- Included in:
- AttemptThis
- Defined in:
- lib/attempt_this/attempt_this.rb,
lib/attempt_this/attempt_object.rb,
lib/attempt_this/binary_backoff_policy.rb,
lib/attempt_this/exception_type_filter.rb
Defined Under Namespace
Classes: AttemptObject, BinaryBackoffPolicy, ExceptionTypeFilter
Class Method Summary collapse
-
.reset ⇒ Object
Resets all static data (scenarios).
Instance Method Summary collapse
-
#attempt(enumerator, &block) ⇒ Object
Attempts code block until it doesn’t throw an exception or the end of enumerator has been reached.
- #enabled=(value) ⇒ Object
- #enabled? ⇒ Boolean
Class Method Details
.reset ⇒ Object
Resets all static data (scenarios). This is intended to use by tests only (to reset scenarios)
23 24 25 |
# File 'lib/attempt_this/attempt_this.rb', line 23 def self.reset AttemptObject.reset end |
Instance Method Details
#attempt(enumerator, &block) ⇒ Object
Attempts code block until it doesn’t throw an exception or the end of enumerator has been reached.
7 8 9 10 11 12 |
# File 'lib/attempt_this/attempt_this.rb', line 7 def attempt(enumerator, &block) raise(ArgumentError, 'Nil enumerator!') if enumerator.nil? impl = AttemptObject::get_object(enumerator) impl.attempt(block) end |
#enabled=(value) ⇒ Object
18 19 20 |
# File 'lib/attempt_this/attempt_this.rb', line 18 def enabled=(value) @enabled = value end |
#enabled? ⇒ Boolean
14 15 16 |
# File 'lib/attempt_this/attempt_this.rb', line 14 def enabled? @enabled.nil? || @enabled end |