class Waiting
Waits for things so you don't have to
Constants
- VERSION
The version of
Waiting
Attributes
The default exp base
@return [Numeric]
The default interval
@return [Numeric]
The default max attempts
@return [Numeric]
The default max interval
@return [Numeric]
Public Class Methods
@param interval [Numeric] Polling interval in seconds. @param max_attempts [Numeric] Number of attempts before timing out. @param exp_base [Numeric] Increases the interval by the power of attempts. @param max_interval [Numeric] Interval limit for exponential backoff.
@yield Block to check if the wait is over. @yieldparam waiter [Waiting::Waiter] call #done
if the wait is over
# File lib/waiting.rb, line 14 def initialize(exp_base: self.class.default_exp_base, interval: self.class.default_interval, max_attempts: self.class.default_max_attempts, max_interval: self.class.default_max_interval, &block) @exp_base = exp_base @interval = interval @max_attempts = max_attempts @max_interval = max_interval @block = block end
@see #wait
@param interval [Numeric] Polling interval in seconds. @param max_attempts [Numeric] Number of attempts before timing out. @param exp_base [Numeric] Increases the interval by the power of attempts. @param max_interval [Numeric] Interval limit for exponential backoff.
@yield Block to check if the wait is over. @yieldparam waiter [Waiting::Waiter] call #done
if the wait is over
# File lib/waiting.rb, line 91 def self.wait(exp_base: default_exp_base, interval: default_interval, max_attempts: default_max_attempts, max_interval: default_max_interval, &block) new(exp_base: exp_base, interval: interval, max_attempts: max_attempts, max_interval: max_interval, &block).wait end
Public Instance Methods
@param interval [Numeric] Polling interval in seconds. @param max_attempts [Numeric] Number of attempts before timing out. @param exp_base [Numeric] Increases the interval by the power of attempts. @param max_interval [Numeric] Interval limit for exponential backoff.
@yield Block to check if the wait is over. @yieldparam waiter [Waiting::Waiter] call #done
if the wait is over
# File lib/waiting.rb, line 67 def wait(exp_base: @exp_base, interval: @interval, max_attempts: @max_attempts, max_interval: @max_interval, &block) Waiter.new( exp_base: exp_base, interval: interval, max_attempts: max_attempts, max_interval: max_interval ).wait(&(block || @block)) end