Class: RailsWorkflow::ProcessTemplate

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
RailsWorkflow::ProcessTemplates::DefaultBuilder, Uuid
Defined in:
app/models/rails_workflow/process_template.rb

Instance Method Summary collapse

Methods included from Uuid

#generate_guid

Instance Method Details

#dependent_operations(operation) ⇒ Object

here we calculate template operations that depends on given process operation status and template id



31
32
33
34
35
36
37
# File 'app/models/rails_workflow/process_template.rb', line 31

def dependent_operations operation
  operations.select do |top|
    top.dependencies.select do |dp|
      dp['id'] == operation.template.id && dp['statuses'].include?(operation.status)
    end.present?
  end
end

#independent_operationsObject



25
26
27
# File 'app/models/rails_workflow/process_template.rb', line 25

def independent_operations
  operations.independent_only.to_a
end

#manager_classObject



20
21
22
23
# File 'app/models/rails_workflow/process_template.rb', line 20

def manager_class
  get_class_for(:manager_class,
                RailsWorkflow.config.manager_class)
end

#other_processesObject



8
9
10
# File 'app/models/rails_workflow/process_template.rb', line 8

def other_processes
  ProcessTemplate.where.not(id: self.id)
end

#process_classObject

we try to read process class from template and set default Workflow::Process if blank process_class on template



15
16
17
18
# File 'app/models/rails_workflow/process_template.rb', line 15

def process_class
  get_class_for :process_class,
                RailsWorkflow.config.process_class
end