Module: Trailblazer::Operation::Callback

Defined in:
lib/trailblazer/operation/callback.rb

Defined Under Namespace

Modules: DSL

Class Method Summary collapse

Class Method Details

.call(name = :default, operation, options) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/trailblazer/operation/callback.rb', line 11

def self.call(name=:default, operation, options)
  config  = options["callback.#{name}.class"] || raise #.fetch(name) # TODO: test exception
  group   = config[:group].new(options["contract.default"])

  options[:context] ||= (config[:context] == :operation ? operation : group)
  group.(options)

  options["result.callback.#{name}"] = group
end