class Trailblazer::Operation

The Trailblazer-style operation. Note that you don't have to use our “opinionated” version with result object, skills, etc.

Dependencies can be defined on the operation. class level

Operations is simply a thin API to define, inherit and run circuits by passing the options object. It encourages the linear railway style (trb.to/gems/workflow/circuit.html#operation) but can easily be extend for more complex workflows.

Public Class Methods

Callable(*args) click to toggle source

Use {Callable} if you have an operation or any other callable object that does not expose an {Activity interface}. For example, {Operation.call} isn't compatible with activities, hence you need to decorate it using {Callable}. The returned object exposes an {Activity interface}.

@param :call [Symbol] Method name to call @param options [Hash] Hash to merge into {circuit_options}, e.g. {:start_task}.

@example Create and use a Callable instance.

callable = Trailblazer::Operation::Callable( Memo::Create, call: :__call__ )
callable.( [ctx, {}] ) #=> Activity interface, ::call will invoke Memo::Create.__call__.
# File lib/trailblazer/operation/callable.rb, line 14
def self.Callable(*args)
  Callable.new(*args)
end