Class: Controll::Flow::Master::Executor
- Inherits:
-
Executor::Base
- Object
- Executor::Base
- Controll::Flow::Master::Executor
- Defined in:
- lib/controll/flow/master/executor.rb
Constant Summary collapse
- Flow =
Controll::Flow
- NoEventsDefinedError =
Flow::NoEventsDefinedError
- NoMappingFoundError =
Flow::NoMappingFoundError
Instance Attribute Summary collapse
-
#action_handlers ⇒ Object
readonly
Returns the value of attribute action_handlers.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Attributes inherited from Executor::Base
Instance Method Summary collapse
- #errors ⇒ Object
- #execute ⇒ Object
-
#initialize(initiator, options) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(initiator, options) ⇒ Executor
Returns a new instance of Executor.
11 12 13 14 15 16 17 18 |
# File 'lib/controll/flow/master/executor.rb', line 11 def initialize initiator, raise ArgumentError, "Must take an options arg" unless .kind_of?(Hash) raise ArgumentError, "Must take an :event option" unless [:event] raise ArgumentError, "Must take an :action_handlers option" unless [:action_handlers] super @event = [:event] @action_handlers = [:action_handlers] end |
Instance Attribute Details
#action_handlers ⇒ Object (readonly)
Returns the value of attribute action_handlers.
9 10 11 |
# File 'lib/controll/flow/master/executor.rb', line 9 def action_handlers @action_handlers end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
9 10 11 |
# File 'lib/controll/flow/master/executor.rb', line 9 def event @event end |
Instance Method Details
#errors ⇒ Object
35 36 37 |
# File 'lib/controll/flow/master/executor.rb', line 35 def errors @errors ||= [] end |
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/controll/flow/master/executor.rb', line 20 def execute action_handlers.each do |action_handler| begin action_handler_clazz = handler_class(action_handler) next unless action_handler_clazz return action_handler_clazz.action(controller, event) rescue NoEventsDefinedError => e errors << e rescue NoMappingFoundError => e errors << e end end fallback end |