Class: ProcessEngine::Listener::Base
- Inherits:
-
Object
- Object
- ProcessEngine::Listener::Base
- Defined in:
- app/models/process_engine/listener/base.rb
Instance Attribute Summary collapse
-
#listener ⇒ Object
readonly
Returns the value of attribute listener.
-
#process_task ⇒ Object
readonly
Returns the value of attribute process_task.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(process_task, listener) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(process_task, listener) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'app/models/process_engine/listener/base.rb', line 4 def initialize(process_task, listener) @process_task = process_task @listener = listener end |
Instance Attribute Details
#listener ⇒ Object (readonly)
Returns the value of attribute listener.
2 3 4 |
# File 'app/models/process_engine/listener/base.rb', line 2 def listener @listener end |
#process_task ⇒ Object (readonly)
Returns the value of attribute process_task.
2 3 4 |
# File 'app/models/process_engine/listener/base.rb', line 2 def process_task @process_task end |
Class Method Details
.execute(process_task, listeners, event) ⇒ Object
9 10 11 |
# File 'app/models/process_engine/listener/base.rb', line 9 def self.execute(process_task, listeners, event) listeners.select { |ln| ln[:event] == event}.each { |listener| new(process_task, listener).execute } end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/process_engine/listener/base.rb', line 13 def execute listener_type = listener[:type] case listener_type when "class_name" execute_class_name when "delegate_expression" execute_delegate_expression when "expression" execute_expression when "script" execute_script else raise "No such type (#{listener_type}) supported" end end |