Sha256: 50f9ef565b115686a28fb1b8422724ed339c79c3d993a1cf7dbb344543686d1a

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

# frozen_string_literal: true

require "dry/effects/effect"

module Dry
  module Effects
    module Effects
      class Async < ::Module
        Async = Effect.new(type: :async, name: :async)

        Await = Effect.new(type: :async, name: :await)

        def initialize
          super

          module_eval do
            define_method(:async) { |&block| ::Dry::Effects.yield(Async.(block)) }
            define_method(:await) { |task| ::Dry::Effects.yield(Await.(task)) }
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-effects-0.2.0 lib/dry/effects/effects/async.rb