Sha256: 075a0e1a2843040a20f31af9fb54c5ef2711fbe9738fa85486dd1a6355c96b77

Contents?: true

Size: 684 Bytes

Versions: 6

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

require 'dry/effects/effect'
require 'dry/effects/constructors'

module Dry
  module Effects
    module Effects
      class Retry < ::Module
        class Retry < Effect
          include ::Dry::Equalizer(:type, :name, :payload, :scope)

          option :scope
        end

        Constructors.register(:Retry) do |scope|
          Retry.new(type: :retry, scope: scope)
        end

        def initialize
          module_eval do
            define_method(:repeat) do |scope|
              effect = Retry.new(type: :retry, scope: scope)
              ::Dry::Effects.yield(effect)
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-effects-0.1.5 lib/dry/effects/effects/retry.rb
dry-effects-0.1.4 lib/dry/effects/effects/retry.rb
dry-effects-0.1.3 lib/dry/effects/effects/retry.rb
dry-effects-0.1.2 lib/dry/effects/effects/retry.rb
dry-effects-0.1.1 lib/dry/effects/effects/retry.rb
dry-effects-0.1.0 lib/dry/effects/effects/retry.rb