Class: RailsExecution::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_execution/config.rb

Constant Summary collapse

DEFAULT_PER_PAGE =
20
DEFAULT_FILE_TYPES =
{
  '.png': 'image/png',
  '.gif': 'image/gif',
  '.jpg': 'image/jpg',
  '.jpeg': 'image/jpeg',
  '.pdf': 'application/pdf',
  '.csv': ['text/csv', 'text/plain'],
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Config

Returns a new instance of Config.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/rails_execution/config.rb', line 56

def initialize
  self.solo_mode = true

  self.owner_model = defined?(::User) ? 'User' : nil
  self.owner_method = :current_user
  self.owner_name_method = :name
  self.owner_avatar = ->(_) { nil }

  self.auto_suggestions = [
    'app/models',
    'app/jobs',
  ]
  self.file_upload = false
  self.acceptable_file_types = DEFAULT_FILE_TYPES
  self.file_uploader = ::RailsExecution::Files::Uploader
  self.file_reader = ::RailsExecution::Files::Reader

  self.task_schedulable = false
  self.task_scheduler = ->(_scheduled_at, _task_id) { nil }
  self.scheduled_task_remover = ->(_task_id) { nil }

  self.task_background = false
  self.task_background_executor = ->(_task_id) { nil }

  self.per_page = DEFAULT_PER_PAGE
  self.reviewers = -> { [] }

  self.task_creatable = ->(_user) { true }
  self.task_editable = ->(_user, _task) { true }
  self.task_closable = ->(_user, _task) { true }
  self.task_approvable = ->(_user, _task) { true }
  self.task_executable = ->(_user, _task) { true }

  self.logging = ->(_log_file, _task) {}
  self.logging_files = ->(_task) { [] }

  self.notifier = ::RailsExecution::Services::Notifier
end

Instance Attribute Details

#acceptable_file_types ⇒ Object

Returns the value of attribute acceptable_file_types.



43
44
45
# File 'lib/rails_execution/config.rb', line 43

def acceptable_file_types
  @acceptable_file_types
end

#auto_suggestions ⇒ Object

On/Off the code editor auto suggestion



44
45
46
# File 'lib/rails_execution/config.rb', line 44

def auto_suggestions
  @auto_suggestions
end

#file_reader ⇒ Object

Returns the value of attribute file_reader.



37
38
39
# File 'lib/rails_execution/config.rb', line 37

def file_reader
  @file_reader
end

#file_upload ⇒ Object

Advanced



35
36
37
# File 'lib/rails_execution/config.rb', line 35

def file_upload
  @file_upload
end

#file_uploader ⇒ Object

Returns the value of attribute file_uploader.



36
37
38
# File 'lib/rails_execution/config.rb', line 36

def file_uploader
  @file_uploader
end

#logging ⇒ Object

Logger



47
48
49
# File 'lib/rails_execution/config.rb', line 47

def logging
  @logging
end

#logging_files ⇒ Object

Returns the value of attribute logging_files.



48
49
50
# File 'lib/rails_execution/config.rb', line 48

def logging_files
  @logging_files
end

#notifier ⇒ Object

Notify



54
55
56
# File 'lib/rails_execution/config.rb', line 54

def notifier
  @notifier
end

#owner_avatar ⇒ Object

lambda



22
23
24
# File 'lib/rails_execution/config.rb', line 22

def owner_avatar
  @owner_avatar
end

#owner_method ⇒ Object

Returns the value of attribute owner_method.



20
21
22
# File 'lib/rails_execution/config.rb', line 20

def owner_method
  @owner_method
end

#owner_model ⇒ Object

Owner display



19
20
21
# File 'lib/rails_execution/config.rb', line 19

def owner_model
  @owner_model
end

#owner_name_method ⇒ Object

Returns the value of attribute owner_name_method.



21
22
23
# File 'lib/rails_execution/config.rb', line 21

def owner_name_method
  @owner_name_method
end

#per_page ⇒ Object

Paging



51
52
53
# File 'lib/rails_execution/config.rb', line 51

def per_page
  @per_page
end

#reviewers ⇒ Object

Task control



25
26
27
# File 'lib/rails_execution/config.rb', line 25

def reviewers
  @reviewers
end

#scheduled_task_remover ⇒ Object

lambda



40
41
42
# File 'lib/rails_execution/config.rb', line 40

def scheduled_task_remover
  @scheduled_task_remover
end

#solo_mode ⇒ Object

Solo mode without reviewing process



16
17
18
# File 'lib/rails_execution/config.rb', line 16

def solo_mode
  @solo_mode
end

#task_approvable ⇒ Object

lambda



31
32
33
# File 'lib/rails_execution/config.rb', line 31

def task_approvable
  @task_approvable
end

#task_background ⇒ Object

Returns the value of attribute task_background.



41
42
43
# File 'lib/rails_execution/config.rb', line 41

def task_background
  @task_background
end

#task_background_executor ⇒ Object

lambda



42
43
44
# File 'lib/rails_execution/config.rb', line 42

def task_background_executor
  @task_background_executor
end

#task_closable ⇒ Object

lambda



29
30
31
# File 'lib/rails_execution/config.rb', line 29

def task_closable
  @task_closable
end

#task_creatable ⇒ Object

lambda



30
31
32
# File 'lib/rails_execution/config.rb', line 30

def task_creatable
  @task_creatable
end

#task_editable ⇒ Object

Accessible check



28
29
30
# File 'lib/rails_execution/config.rb', line 28

def task_editable
  @task_editable
end

#task_executable ⇒ Object

lambda



32
33
34
# File 'lib/rails_execution/config.rb', line 32

def task_executable
  @task_executable
end

#task_schedulable ⇒ Object

Returns the value of attribute task_schedulable.



38
39
40
# File 'lib/rails_execution/config.rb', line 38

def task_schedulable
  @task_schedulable
end

#task_scheduler ⇒ Object

lambda



39
40
41
# File 'lib/rails_execution/config.rb', line 39

def task_scheduler
  @task_scheduler
end