Class: Pal::Handler::Manager

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/pal/handler/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Log

#log_debug, #log_error, #log_info, #log_warn

Constructor Details

#initialize(handler) ⇒ Manager

Returns a new instance of Manager.

Parameters:

Raises:

  • (TypeError)


11
12
13
14
15
# File 'lib/pal/handler/manager.rb', line 11

def initialize(handler)
  raise TypeError.new("Service must be type of BaseServiceImpl") unless handler.is_a? Base

  @handler = handler
end

Instance Attribute Details

#handlerObject

Returns the value of attribute handler.



8
9
10
# File 'lib/pal/handler/manager.rb', line 8

def handler
  @handler
end

Instance Method Details

#process_runbook(runbook) ⇒ Array, Hash

Parameters:

Returns:

  • (Array, Hash)


19
20
21
22
23
24
25
26
27
# File 'lib/pal/handler/manager.rb', line 19

def process_runbook(runbook)
  Pal.logger.info("Beginning execution of playbook ...")
  ctx = @handler.process_runbook

  log_info "No exporter defined." unless runbook.exporter
  log_info "No candidates found." unless ctx.candidates.size.positive?

  runbook.exporter.perform_export(ctx)
end