class RailsWorkflow::Config
Engine
configuration. Allows to set default or custom classes and other engine settings.
Attributes
activejob_enabled[RW]
assignment_by[W]
import_preprocessor[W]
operation_types[RW]
process_class[W]
sql_dialect[W]
TODO: rework defaults
Public Class Methods
new()
click to toggle source
# File lib/rails_workflow/config.rb, line 32 def initialize # rubocop: disable Metrics/MethodLength init_default_operation_types # TODO: rework @default_assignment_by = %i[group role] @default_import_preprocessor = 'RailsWorkflow::DefaultImporterPreprocessor' @default_operation_template_type = 'RailsWorkflow::OperationTemplate' @default_process_manager = 'RailsWorkflow::ProcessManager' @default_process_builder = 'RailsWorkflow::ProcessBuilder' @default_operation_builder = 'RailsWorkflow::OperationBuilder' @default_error_builder = 'RailsWorkflow::ErrorBuilder' @default_error_resolver = 'RailsWorkflow::ErrorResolver' @default_process_class = 'RailsWorkflow::Process' @default_process_template_type = 'RailsWorkflow::ProcessTemplate' @default_sql_dialect = 'pg' @default_process_runner = 'RailsWorkflow::ProcessRunner' @default_operation_runner = 'RailsWorkflow::OperationRunner' @default_dependency_resolver = 'RailsWorkflow::DependencyResolver' end
Public Instance Methods
assignment_by()
click to toggle source
# File lib/rails_workflow/config.rb, line 67 def assignment_by @assignment_by || @default_assignment_by end
default_operation_template_type()
click to toggle source
# File lib/rails_workflow/config.rb, line 87 def default_operation_template_type @operation_template_type || @default_operation_template_type end
import_preprocessor()
click to toggle source
# File lib/rails_workflow/config.rb, line 82 def import_preprocessor processor = @import_preprocessor || @default_import_preprocessor processor.constantize.new end
manager_class()
click to toggle source
# File lib/rails_workflow/config.rb, line 95 def manager_class @process_manager || @default_process_manager end
manager_class=(value)
click to toggle source
# File lib/rails_workflow/config.rb, line 91 def manager_class=(value) @process_manager = value end
operation_template_klass=(value)
click to toggle source
TODO: fix
# File lib/rails_workflow/config.rb, line 76 def operation_template_klass=(value) @operation_template_type = value end
process_class()
click to toggle source
# File lib/rails_workflow/config.rb, line 105 def process_class @process_class || @default_process_class end
process_manager()
click to toggle source
# File lib/rails_workflow/config.rb, line 113 def process_manager # Todo add custom managers support ProcessManager end
process_template_klass=(value)
click to toggle source
# File lib/rails_workflow/config.rb, line 101 def process_template_klass=(value) @process_template_type = value end
process_template_type()
click to toggle source
# File lib/rails_workflow/config.rb, line 109 def process_template_type @process_template_type || @default_process_template_type end
sql_dialect()
click to toggle source
# File lib/rails_workflow/config.rb, line 57 def sql_dialect case @sql_dialect || @default_sql_dialect when 'pg' RailsWorkflow::Db::Pg when 'mysql' RailsWorkflow::Db::Mysql end end
Private Instance Methods
init_default_operation_types()
click to toggle source
# File lib/rails_workflow/config.rb, line 131 def init_default_operation_types # TODO: it should allow user_role and user_group operations # only if user responds to necessary methods. @default_operation_types = { default: { title: 'Default Operation', class: 'RailsWorkflow::Operation' }, event: { title: 'Event', class: 'RailsWorkflow::EventOperation' }, user: { title: 'User Operation', class: 'RailsWorkflow::UserOperation' }, user_role: { title: 'Operation for User By Role', class: 'RailsWorkflow::UserByRoleOperation' }, user_group: { title: 'Operation by User Group', class: 'RailsWorkflow::UserByGroupOperation' } } end