class Retryable::Configuration
Used to set up and modify settings for the retryable.
Constants
- OPTIONS
Attributes
enabled[RW]
enabled?[RW]
ensure[RW]
exception_cb[RW]
matching[RW]
not[RW]
on[RW]
sleep[RW]
tries[RW]
Public Class Methods
new()
click to toggle source
# File lib/retryable/configuration.rb, line 26 def initialize @ensure = Proc.new {} @exception_cb = Proc.new {} @matching = /.*/ @on = StandardError @sleep = 1 @tries = 2 @not = [] @enabled = true end
Public Instance Methods
[](option)
click to toggle source
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/retryable/configuration.rb, line 49 def [](option) send(option) end
disable()
click to toggle source
# File lib/retryable/configuration.rb, line 42 def disable @enabled = false end
enable()
click to toggle source
# File lib/retryable/configuration.rb, line 38 def enable @enabled = true end
merge(hash)
click to toggle source
Returns a hash of all configurable options merged with hash
@param [Hash] hash A set of configuration options that will take precedence over the defaults
# File lib/retryable/configuration.rb, line 64 def merge(hash) to_hash.merge(hash) end
to_hash()
click to toggle source
Returns a hash of all configurable options
# File lib/retryable/configuration.rb, line 54 def to_hash OPTIONS.inject({}) do |hash, option| hash[option.to_sym] = self.send(option) hash end end