Class: RailsWorkflow::ProcessManager
- Inherits:
-
Object
- Object
- RailsWorkflow::ProcessManager
- Defined in:
- app/managers/rails_workflow/process_manager.rb
Instance Attribute Summary collapse
-
#process ⇒ Object
Returns the value of attribute process.
-
#template ⇒ Object
Returns the value of attribute template.
Class Method Summary collapse
Instance Method Summary collapse
- #complete_process ⇒ Object
-
#initialize(process = nil) ⇒ ProcessManager
constructor
A new instance of ProcessManager.
- #operation_complete(operation) ⇒ Object
- #operation_exception ⇒ Object
- #start_process ⇒ Object
Constructor Details
#initialize(process = nil) ⇒ ProcessManager
Returns a new instance of ProcessManager.
18 19 20 21 22 23 |
# File 'app/managers/rails_workflow/process_manager.rb', line 18 def initialize process = nil if process @process = process @template = process.template end end |
Instance Attribute Details
#process ⇒ Object
Returns the value of attribute process.
16 17 18 |
# File 'app/managers/rails_workflow/process_manager.rb', line 16 def process @process end |
#template ⇒ Object
Returns the value of attribute template.
16 17 18 |
# File 'app/managers/rails_workflow/process_manager.rb', line 16 def template @template end |
Class Method Details
.build_process(template_id, context) ⇒ Object
4 5 6 7 |
# File 'app/managers/rails_workflow/process_manager.rb', line 4 def build_process template_id, context template = RailsWorkflow::ProcessTemplate.find template_id template.build_process! context end |
.start_process(template_id, context) ⇒ Object
9 10 11 12 13 |
# File 'app/managers/rails_workflow/process_manager.rb', line 9 def start_process template_id, context process = build_process template_id, context process.try(:start) process end |
Instance Method Details
#complete_process ⇒ Object
41 42 43 44 45 46 |
# File 'app/managers/rails_workflow/process_manager.rb', line 41 def complete_process if process.can_complete? process.complete end end |
#operation_complete(operation) ⇒ Object
35 36 37 38 39 |
# File 'app/managers/rails_workflow/process_manager.rb', line 35 def operation_complete operation process.operation_complete operation complete_process end |
#operation_exception ⇒ Object
31 32 33 |
# File 'app/managers/rails_workflow/process_manager.rb', line 31 def operation_exception process.operation_exception end |
#start_process ⇒ Object
25 26 27 28 29 |
# File 'app/managers/rails_workflow/process_manager.rb', line 25 def start_process process.start rescue => exception RailsWorkflow::Error.create_from exception, parent: process end |