Sha256: 9f3c8d976e94fb843fa22d83f9c9cb3ba3708985d22be3e9f12fed868e6fc9bc

Contents?: true

Size: 429 Bytes

Versions: 2

Compression:

Stored size: 429 Bytes

Contents

# frozen_string_literal: true

require "dry/effects/provider"
require "dry/effects/frame"

module Dry
  module Effects
    module Providers
      class Fork < Provider[:fork]
        attr_reader :stack

        def fork
          stack = self.stack.dup
          -> &cont { Frame.spawn_fiber(stack.dup, &cont) }
        end

        def call
          @stack = Frame.stack
          super
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-effects-0.3.0 lib/dry/effects/providers/fork.rb
dry-effects-0.2.0 lib/dry/effects/providers/fork.rb