Class: RerunTask::Crontab

Inherits:
Object
  • Object
show all
Defined in:
lib/rerun_task/crontab.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCrontab

Returns a new instance of Crontab.



4
5
6
7
# File 'lib/rerun_task/crontab.rb', line 4

def initialize
  @content = %x[crontab -l]
  @content = @content.split("\n")
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/rerun_task/crontab.rb', line 3

def content
  @content
end

Instance Method Details

#find_task(task_name) ⇒ Object



9
10
11
12
13
# File 'lib/rerun_task/crontab.rb', line 9

def find_task(task_name)
  match = @content.reject{|i| !i.include?(task_name)}
  return nil if match.size == 0
  match.first.split(" ")[5,9].join(" ")
end