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

#initializeConfig

Returns a new instance of Config.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rails_execution/config.rb', line 50

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.file_upload = false
  self.acceptable_file_types = DEFAULT_FILE_TYPES
  self.file_uploader = ::RailsExecution::Files::Uploader
  self.file_reader = ::RailsExecution::Files::Reader
  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_typesObject

Returns the value of attribute acceptable_file_types.



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

def acceptable_file_types
  @acceptable_file_types
end

#file_readerObject

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_uploadObject

Advanced



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

def file_upload
  @file_upload
end

#file_uploaderObject

Returns the value of attribute file_uploader.



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

def file_uploader
  @file_uploader
end

#loggingObject

Logger



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

def logging
  @logging
end

#logging_filesObject

Returns the value of attribute logging_files.



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

def logging_files
  @logging_files
end

#notifierObject

Notify



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

def notifier
  @notifier
end

#owner_avatarObject

lambda



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

def owner_avatar
  @owner_avatar
end

#owner_methodObject

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_modelObject

Owner display



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

def owner_model
  @owner_model
end

#owner_name_methodObject

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_pageObject

Paging



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

def per_page
  @per_page
end

#reviewersObject

Task control



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

def reviewers
  @reviewers
end

#solo_modeObject

Solo mode without reviewing process



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

def solo_mode
  @solo_mode
end

#task_approvableObject

lambda



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

def task_approvable
  @task_approvable
end

#task_closableObject

lambda



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

def task_closable
  @task_closable
end

#task_creatableObject

lambda



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

def task_creatable
  @task_creatable
end

#task_editableObject

Accessible check



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

def task_editable
  @task_editable
end

#task_executableObject

lambda



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

def task_executable
  @task_executable
end