lib/dry/effects/providers/retry.rb in dry-effects-0.1.5 vs lib/dry/effects/providers/retry.rb in dry-effects-0.2.0

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'dry/effects/provider' -require 'dry/effects/halt' +require "dry/effects/provider" +require "dry/effects/halt" module Dry module Effects module Providers class Retry < Provider[:retry] @@ -16,18 +16,16 @@ attr_reader :limit # Yield the block with the handler installed # # @api private - def call(limit) + def call(limit, &block) @limit = limit @attempts = 0 loop do - begin - return attempt { yield } - rescue halt - end + return attempt(&block) + rescue halt # rubocop:disable Lint/SuppressedException end end def retry Instructions.Raise(halt.new)