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)


273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/dry/monads/task.rb', line 273

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