lib/dry/effects/providers/retry.rb in dry-effects-0.1.0.alpha2 vs lib/dry/effects/providers/retry.rb in dry-effects-0.1.0
- old
+ new
@@ -13,10 +13,13 @@
attr_reader :attempts
attr_reader :limit
+ # Yield the block with the handler installed
+ #
+ # @api private
def call(_, limit)
@limit = limit
@attempts = 0
loop do
@@ -25,11 +28,11 @@
rescue halt
end
end
end
- def repeat
+ def retry
Instructions.Raise(halt.new)
end
def attempt
if attempts_exhausted?
@@ -50,9 +53,11 @@
def provide?(effect)
super && scope.equal?(effect.scope)
end
+ # @return [String]
+ # @api public
def represent
"retry[#{scope} #{attempts}/#{limit}]"
end
end
end