class Dry::Effects::Providers::Retry
Attributes
attempts[R]
limit[R]
Public Instance Methods
attempt() { || ... }
click to toggle source
# File lib/dry/effects/providers/retry.rb, line 35 def attempt if attempts_exhausted? nil else @attempts += 1 yield end end
attempts_exhausted?()
click to toggle source
# File lib/dry/effects/providers/retry.rb, line 44 def attempts_exhausted? attempts.equal?(limit) end
call(limit, &block)
click to toggle source
Yield the block with the handler installed
@api private
# File lib/dry/effects/providers/retry.rb, line 21 def call(limit, &block) @limit = limit @attempts = 0 loop do return attempt(&block) rescue halt # rubocop:disable Lint/SuppressedException end end
halt()
click to toggle source
# File lib/dry/effects/providers/retry.rb, line 48 def halt Halt[scope] end
provide?(effect)
click to toggle source
Calls superclass method
# File lib/dry/effects/providers/retry.rb, line 52 def provide?(effect) super && scope.equal?(effect.scope) end
represent()
click to toggle source
@return [String] @api public
# File lib/dry/effects/providers/retry.rb, line 58 def represent "retry[#{scope} #{attempts}/#{limit}]" end
retry()
click to toggle source
# File lib/dry/effects/providers/retry.rb, line 31 def retry Instructions.Raise(halt.new) end