Module: Dry::Monads::Task::Mixin

Includes:
Constructors
Defined in:
lib/dry/monads/task.rb

Overview

Task constructors.

Defined Under Namespace

Modules: Constructors

Constant Summary collapse

Task =
Task
Unit =

See Also:

Unit

Class Method Summary collapse

Methods included from Constructors

#Task

Class Method Details

.[](executor) ⇒ Module

Created a mixin with the given executor injected.

Parameters:

  • executor (Concurrent::AbstractExecutorService, Symbol)

Returns:

  • (Module)


285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/dry/monads/task.rb', line 285

def self.[](executor)
  Module.new do
    include Mixin

    # Created a new Task with an injected executor.
    #
    # @param block [Proc]
    # @return [Task]
    define_method(:Task) do |&block|
      Task[executor, &block]
    end
  end
end