Module: Philiprehberger::WebhookBuilder::Backoff

Defined in:
lib/philiprehberger/webhook_builder/backoff.rb

Defined Under Namespace

Classes: Exponential, Fixed, Linear

Class Method Summary collapse

Class Method Details

.resolve(option) ⇒ #call

Resolve a backoff option into a callable strategy.

Parameters:

  • option (Symbol, Proc, nil)

    the backoff strategy

Returns:

  • (#call)

    a callable backoff strategy



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/philiprehberger/webhook_builder/backoff.rb', line 60

def self.resolve(option)
  case option
  when :exponential, nil
    Exponential.new
  when :linear
    Linear.new
  when :fixed
    Fixed.new
  when Proc
    option
  else
    raise ArgumentError, "Unknown backoff strategy: #{option.inspect}. Use :exponential, :linear, :fixed, or a Proc."
  end
end