Sha256: 83539d3f4466e7f9d00fbc7777f025625b8026bc502dc63bf6ee5c07ad6073ef
Contents?: true
Size: 1.59 KB
Versions: 9
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true module RailsWorkflow # = DefaultBuilder # # Process Builder is used to build new process. All process building logic # should be gathered here. It defines how process is build using template # (for example it can used to gather some additional information from # system - for example some information from existing processes or it # can handle hierarchical processes logic for parent / child processes). class ProcessBuilder attr_accessor :template, :context delegate :process_class, :title, :independent_operations, to: :template def initialize(template, context) @template = template @context = context end def create_process! process = process_class.create(template: template) process.update_attributes(title: title, status: Process::NOT_STARTED) process.create_context(data: context, parent: process) build_independent_operations process process end # Independent operations is template operations that have no # dependencies from any other operations def build_independent_operations(process) independent_operations.each do |operation_template| build_operation process, operation_template end end def build_operation(process, template, completed_dependencies = []) operation_builder.new( process, template, completed_dependencies ).create_operation end def error_builder config.error_builder end def config RailsWorkflow.config end def operation_builder config.operation_builder end end end
Version data entries
9 entries across 9 versions & 1 rubygems