Class: RailsWorkflow::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rails_workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rails_workflow.rb', line 26

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

#operation_typesObject

Returns the value of attribute operation_types.



23
24
25
# File 'lib/rails_workflow.rb', line 23

def operation_types
  @operation_types
end

#sidekiq_enabledObject

Returns the value of attribute sidekiq_enabled.



24
25
26
# File 'lib/rails_workflow.rb', line 24

def sidekiq_enabled
  @sidekiq_enabled
end

Instance Method Details

#assignment_byObject



63
64
65
# File 'lib/rails_workflow.rb', line 63

def assignment_by
  @assignment_by || @default_assignment_by
end

#assignment_by=(assignment) ⇒ Object



67
68
69
# File 'lib/rails_workflow.rb', line 67

def assignment_by=(assignment)
  @assignment_by = assignment
end

#default_operation_template_typeObject



88
89
90
# File 'lib/rails_workflow.rb', line 88

def default_operation_template_type
  @operation_template_type || @default_operation_template_type
end

#import_preprocessorObject



83
84
85
86
# File 'lib/rails_workflow.rb', line 83

def import_preprocessor
  processor = @import_preprocessor || @default_import_preprocessor
  processor.constantize.new
end

#import_preprocessor=(value) ⇒ Object



79
80
81
# File 'lib/rails_workflow.rb', line 79

def import_preprocessor=(value)
  @import_preprocessor = value
end

#manager_classObject



96
97
98
# File 'lib/rails_workflow.rb', line 96

def manager_class
  @process_manager || @default_process_manager
end

#manager_class=(value) ⇒ Object



92
93
94
# File 'lib/rails_workflow.rb', line 92

def manager_class=(value)
  @process_manager = value
end

#operation_template_klass=(value) ⇒ Object



75
76
77
# File 'lib/rails_workflow.rb', line 75

def operation_template_klass=(value)
  @operation_template_type = value
end

#process_classObject



108
109
110
# File 'lib/rails_workflow.rb', line 108

def process_class
  @process_class || @default_process_class
end

#process_class=(value) ⇒ Object



100
101
102
# File 'lib/rails_workflow.rb', line 100

def process_class=(value)
  @process_class = value
end

#process_template_klass=(value) ⇒ Object



104
105
106
# File 'lib/rails_workflow.rb', line 104

def process_template_klass=(value)
  @process_template_type = value
end

#process_template_typeObject



112
113
114
# File 'lib/rails_workflow.rb', line 112

def process_template_type
  @process_template_type || @default_process_template_type
end

#sql_dialectObject



50
51
52
53
54
55
56
57
# File 'lib/rails_workflow.rb', line 50

def sql_dialect
  case @sql_dialect || @default_sql_dialect
    when 'pg'
      RailsWorkflow::Db::Pg
    when 'mysql'
      RailsWorkflow::Db::Mysql
  end
end

#sql_dialect=(dialect) ⇒ Object



59
60
61
# File 'lib/rails_workflow.rb', line 59

def sql_dialect=(dialect)
  @sql_dialect = dialect
end