Module: Substation::Processor

Included in:
Incoming, Outgoing, Pivot
Defined in:
lib/substation/processor.rb,
lib/substation/processor/nest.rb,
lib/substation/processor/config.rb,
lib/substation/processor/builder.rb,
lib/substation/processor/wrapper.rb,
lib/substation/processor/executor.rb,
lib/substation/processor/evaluator.rb,
lib/substation/processor/transformer.rb,
lib/substation/processor/evaluator/result.rb,
lib/substation/processor/evaluator/handler.rb

Overview

Namespace for chain processors

Defined Under Namespace

Modules: Fallible, Incoming, Nest, Outgoing, Pivot, Transformer, Wrapper Classes: Builder, Config, Evaluator, Executor

Instance Method Summary collapse

Instance Method Details

#initialize(_name, _handler, _config) ⇒ undefined

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.

Initialize a new instance

Parameters:

  • name (Symbol)

    the processor's name

  • config (Config)

    the processor's configuration

Returns:

  • (undefined)


27
28
29
30
31
32
# File 'lib/substation/processor.rb', line 27

def initialize(_name, _handler, _config)
  super
  @executor      = config.executor
  @observers     = config.observers
  @failure_chain = config.failure_chain
end

#nameObject

#result(response) ⇒ Response

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.

The response passed on to the next processor in a Chain

Parameters:

  • response (Response)

    the response returned from invoking the processor

Returns:

  • (Response)

    the response passed on to the next processor in a Chain



87
88
89
# File 'lib/substation/processor.rb', line 87

def result(response)
  response
end

#success?(response) ⇒ true, false

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.

Test wether chain processing should continue

Parameters:

  • response (Response)

    the response returned from invoking the processor

Returns:

  • (true)

    for a successful response

  • (false)

    otherwise



74
75
76
# File 'lib/substation/processor.rb', line 74

def success?(response)
  response.success?
end