class RailsWorkflow::ProcessManager
ProcessManager
should be used to build and start processes. It is top level hierarchy class that also can be used to build enhancements. For example they can be used to implement processes communications.
Attributes
context[RW]
process[RW]
template[RW]
Public Class Methods
create_process(template_id, context)
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 14 def create_process(template_id, context) new(template_id: template_id, context: context).create_process end
new(process = nil, template_id: nil, context: nil)
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 19 def initialize(process = nil, template_id: nil, context: nil) @process = process @template = ProcessTemplate.find(template_id) if template_id @context = context end
start_process(template_id, context)
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 29 def self.start_process(template_id, context) process = create_process template_id, context new(process).start_process process end
Public Instance Methods
complete_process()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 46 def complete_process process_runner.complete end
config()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 62 def config RailsWorkflow.config end
create_process()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 25 def create_process self.process = process_builder.new(template, context).create_process! end
error_builder()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 50 def error_builder config.error_builder end
process_builder()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 54 def process_builder config.process_builder end
process_runner()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 58 def process_runner @process_runner ||= config.process_runner.new(process) end
start_process()
click to toggle source
# File lib/rails_workflow/process_manager.rb, line 35 def start_process process_runner.start rescue => exception error_builder.handle( exception, parent: process, target: :process_manager, method: :start_process ) end