Sha256: 9e482e193e99b69b280d4731568f7163f5b254cac24afa09ee240ff834fe2465

Contents?: true

Size: 429 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
dry-effects-0.1.5 lib/dry/effects/providers/fork.rb
dry-effects-0.1.4 lib/dry/effects/providers/fork.rb
dry-effects-0.1.3 lib/dry/effects/providers/fork.rb
dry-effects-0.1.2 lib/dry/effects/providers/fork.rb