Class: TasksScheduler::Checker::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks_scheduler/checker/log.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Log



16
17
18
19
# File 'lib/tasks_scheduler/checker/log.rb', line 16

def initialize(key)
  @key = key
  ::FileUtils.mkdir_p(dirname)
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



14
15
16
# File 'lib/tasks_scheduler/checker/log.rb', line 14

def key
  @key
end

Class Method Details

.logs_directoryObject



9
10
11
# File 'lib/tasks_scheduler/checker/log.rb', line 9

def logs_directory
  @logs_directory ||= ::Rails.root.join('log', 'tasks_scheduler', 'checker')
end

Instance Method Details

#dirnameObject



21
22
23
# File 'lib/tasks_scheduler/checker/log.rb', line 21

def dirname
  ::File.dirname(path)
end

#exist?Boolean



25
26
27
# File 'lib/tasks_scheduler/checker/log.rb', line 25

def exist?
  ::File.exist?(path)
end

#pathObject



29
30
31
# File 'lib/tasks_scheduler/checker/log.rb', line 29

def path
  self.class.logs_directory.join("#{key}.log")
end