Class: Hecks::Bluebook::DSL::ProcessManagerBuilder::HandlerBuilder::DispatchBuilder

Inherits:
Object
  • Object
show all
Includes:
WordGate
Defined in:
lib/hecks/bluebook/dsl/process_manager_builder.rb

Overview

THE NESTED SCOPE dispatch ... do ... end OPENS — one word only (compensates), the compensating half of the dispatch it sits inside. Its own compensates_impl builds a SECOND DispatchSpec, shape-identical to HandlerBuilder#dispatch_ impl's own — a compensation takes the exact same two arguments (a bare command constant, an optional with:) because it resolves through the identical scope (current event payload, opening event memory, correlation binding) any saga dispatch already does (SagaInterpreter#dispatch_args).

Constant Summary collapse

GRAMMAR_CONTEXT =
"Dispatch"

Constants included from WordGate

WordGate::NOT_ADMITTED

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hecks::Bluebook::DSL::WordGate

Instance Method Details

#compensates_impl(command_ref, with: nil) ⇒ Object



289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/hecks/bluebook/dsl/process_manager_builder.rb', line 289

def compensates_impl(command_ref, with: nil)
  if command_ref.is_a?(::String) && !MetaValidator.shadow_parsing?
    raise InvalidProcessManager,
          "compensates #{command_ref.inspect} is quoted text — give the bare command constant " \
          "instead, e.g. compensates Account::Credit"
  end

  @compensates_spec = DispatchSpec.new(
    command_name: Naming.command_ref(command_ref),
    with_spec:    (with || {}).to_a
  )
end