Class: RailsWorkflow::Config
- Inherits:
-
Object
- Object
- RailsWorkflow::Config
- Includes:
- Singleton
- Defined in:
- lib/rails_workflow/config.rb
Instance Attribute Summary collapse
-
#activejob_enabled ⇒ Object
Returns the value of attribute activejob_enabled.
- #assignment_by ⇒ Object
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
- #import_preprocessor ⇒ Object
-
#operation_types ⇒ Object
Returns the value of attribute operation_types.
- #process_class ⇒ Object
- #sql_dialect ⇒ Object
Instance Method Summary collapse
- #default_operation_template_type ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #manager_class ⇒ Object
- #manager_class=(value) ⇒ Object
- #operation_template_klass=(value) ⇒ Object
- #process_template_klass=(value) ⇒ Object
- #process_template_type ⇒ Object
-
#template(template_id) ⇒ Object
template_id - Process Template Id.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rails_workflow/config.rb', line 20 def initialize @default_operation_types = { default: { title: 'Default Operation', class: 'RailsWorkflow::Operation' }, user_role: { title: 'Operation for User By Role', class: 'RailsWorkflow::UserByRoleOperation' }, user_group: { title: 'Operation by User Group', class: 'RailsWorkflow::UserByGroupOperation' } } @default_import_preprocessor = 'RailsWorkflow::DefaultImporterPreprocessor' @default_operation_template_type = 'RailsWorkflow::OperationTemplate' @default_process_manager = 'RailsWorkflow::ProcessManager' @default_process_class = 'RailsWorkflow::Process' @default_process_template_type = 'RailsWorkflow::ProcessTemplate' @default_assignment_by = [:group, :role] @default_sql_dialect = 'pg' end |
Instance Attribute Details
#activejob_enabled ⇒ Object
Returns the value of attribute activejob_enabled.
16 17 18 |
# File 'lib/rails_workflow/config.rb', line 16 def activejob_enabled @activejob_enabled end |
#assignment_by ⇒ Object
53 54 55 |
# File 'lib/rails_workflow/config.rb', line 53 def assignment_by @assignment_by || @default_assignment_by end |
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
18 19 20 |
# File 'lib/rails_workflow/config.rb', line 18 def cache @cache end |
#import_preprocessor ⇒ Object
65 66 67 68 |
# File 'lib/rails_workflow/config.rb', line 65 def import_preprocessor processor = @import_preprocessor || @default_import_preprocessor processor.constantize.new end |
#operation_types ⇒ Object
Returns the value of attribute operation_types.
16 17 18 |
# File 'lib/rails_workflow/config.rb', line 16 def operation_types @operation_types end |
#process_class ⇒ Object
86 87 88 |
# File 'lib/rails_workflow/config.rb', line 86 def process_class @process_class || @default_process_class end |
#sql_dialect ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/rails_workflow/config.rb', line 44 def sql_dialect case @sql_dialect || @default_sql_dialect when 'pg' RailsWorkflow::Db::Pg when 'mysql' RailsWorkflow::Db::Mysql end end |
Instance Method Details
#default_operation_template_type ⇒ Object
70 71 72 |
# File 'lib/rails_workflow/config.rb', line 70 def default_operation_template_type @operation_template_type || @default_operation_template_type end |
#manager_class ⇒ Object
78 79 80 |
# File 'lib/rails_workflow/config.rb', line 78 def manager_class @process_manager || @default_process_manager end |
#manager_class=(value) ⇒ Object
74 75 76 |
# File 'lib/rails_workflow/config.rb', line 74 def manager_class=(value) @process_manager = value end |
#operation_template_klass=(value) ⇒ Object
61 62 63 |
# File 'lib/rails_workflow/config.rb', line 61 def operation_template_klass=(value) @operation_template_type = value end |
#process_template_klass=(value) ⇒ Object
82 83 84 |
# File 'lib/rails_workflow/config.rb', line 82 def process_template_klass=(value) @process_template_type = value end |
#process_template_type ⇒ Object
90 91 92 |
# File 'lib/rails_workflow/config.rb', line 90 def process_template_type @process_template_type || @default_process_template_type end |
#template(template_id) ⇒ Object
template_id - Process Template Id
95 96 97 98 |
# File 'lib/rails_workflow/config.rb', line 95 def template(template_id) @cache ||= {} @cache[template_id.to_i] ||= RailsWorkflow::ProcessTemplate.eager_load(:operations).find(template_id) end |