Class: Flor::ModuleGanger
- Inherits:
-
Object
- Object
- Flor::ModuleGanger
- Defined in:
- lib/flor/unit/gangers.rb
Overview
A ModuleGanger accepts a ‘module:` conf entry that points to a Ruby module. The tasker implementations are searched for among the classes in the given module.
Among the tasker classes (classes that respond to on_task, on_detask, …) it selects the first tasker that matches the tasker name.
Instance Method Summary collapse
-
#initialize(service, conf, message) ⇒ ModuleGanger
constructor
A new instance of ModuleGanger.
- #task ⇒ Object (also: #detask)
Constructor Details
#initialize(service, conf, message) ⇒ ModuleGanger
Returns a new instance of ModuleGanger.
14 15 16 17 18 19 |
# File 'lib/flor/unit/gangers.rb', line 14 def initialize(service, conf, ) @service = service @conf = conf @message = end |
Instance Method Details
#task ⇒ Object Also known as: detask
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flor/unit/gangers.rb', line 21 def task tas = @message['tasker'] clas = list_tasker_classes cla = clas.find { |c| tasker_name(c) == tas } return [ Flor.dup_and_merge(@message, 'routed' => false) ] \ unless cla call_tasker(cla) end |