class States::Dsl::Retry

Public Class Methods

new(*arguments) click to toggle source
# File lib/states/dsl/retry.rb, line 6
def initialize(*arguments)
  options = arguments.last.is_a?(Hash) ? arguments.pop : {}
  @error_equals = if arguments.length > 0
    ensure_errors_array(arguments.first)
  else
    ensure_errors_array(options[:error_equals])
  end
  @max_attempts = options[:max_attempts]
  @backoff_rate = options[:backoff_rate]
  @interval_seconds = options[:interval_seconds]
end

Public Instance Methods

backoff_rate(r) click to toggle source
# File lib/states/dsl/retry.rb, line 22
def backoff_rate(r)
  @backoff_rate = r
end
interval_seconds(s) click to toggle source
# File lib/states/dsl/retry.rb, line 26
def interval_seconds(s)
  @interval_seconds = s
end
max_attempts(n) click to toggle source
# File lib/states/dsl/retry.rb, line 18
def max_attempts(n)
  @max_attempts = n
end
serializable_hash() click to toggle source
# File lib/states/dsl/retry.rb, line 30
def serializable_hash
  h = { "ErrorEquals" => @error_equals }
  h["MaxAttempts"] = @max_attempts if @max_attempts
  h["BackoffRate"] = @backoff_rate if @backoff_rate
  h["IntervalSeconds"] = @interval_seconds if @interval_seconds
  h
end