Class: LightServiceExt::ApplicationOrchestrator

Inherits:
ApplicationOrganizer show all
Defined in:
lib/light-service-ext/application_orchestrator.rb

Class Method Summary collapse

Methods inherited from ApplicationOrganizer

reduce_if_success, steps

Methods included from WithErrorHandler

#with_error_handler

Class Method Details

.call(context, &each_organizer_result) ⇒ Object



4
5
6
7
8
# File 'lib/light-service-ext/application_orchestrator.rb', line 4

def call(context, &each_organizer_result)
  orchestrator_ctx = process_each_organizer(ApplicationContext.make_with_defaults(context),
                                            &each_organizer_result)
  with(orchestrator_ctx).around_each(RecordActions).reduce(all_steps)
end

.organizer_stepsObject

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/light-service-ext/application_orchestrator.rb', line 10

def organizer_steps
  raise NotImplementedError
end

.process_each_organizer(orchestrator_ctx, &each_organizer_result) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/light-service-ext/application_orchestrator.rb', line 14

def process_each_organizer(orchestrator_ctx, &each_organizer_result)
  organizer_steps.each do |step_class|
    exec_method = exec_method_for(step_class)
    current_organizer_ctx = step_class.send(exec_method, orchestrator_ctx.input)
    yield(current_organizer_ctx, orchestrator_ctx: orchestrator_ctx) if each_organizer_result
  end
  orchestrator_ctx
end