Class: Dry::Effects::Effects::Async

Inherits:
Module
  • Object
show all
Defined in:
lib/dry/effects/effects/async.rb

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initializeAsync

Returns a new instance of Async.



11
12
13
14
15
16
17
18
# File 'lib/dry/effects/effects/async.rb', line 11

def initialize
  super

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