Class: Substation::Processor::Nest::Incoming

Inherits:
Object
  • Object
show all
Includes:
Incoming
Defined in:
lib/substation/processor/nest.rb

Overview

An incoming processor that calls a nested chain

Instance Method Summary collapse

Methods included from Incoming

#result

Methods included from Fallible

#with_failure_chain

Methods included from Substation::Processor

#initialize, #name, #result, #success?

Instance Method Details

#call(request) ⇒ Response::Success

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Call the processor



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/substation/processor/nest.rb', line 22

def call(request)
  state = invoke(decompose(request))

  case state
  when Request
    request.success(compose(request, request.success(state.data)))
  when Response::Success
    request.success(compose(request, state))
  when Response::Failure
    request.error(compose(request, state))
  else
    raise 'Illegal state returned from the invoked handler'
  end
end