Class: RerunTask::Crontab
- Inherits:
-
Object
- Object
- RerunTask::Crontab
- Defined in:
- lib/rerun_task/crontab.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #find_task(task_name) ⇒ Object
-
#initialize ⇒ Crontab
constructor
A new instance of Crontab.
Constructor Details
#initialize ⇒ Crontab
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
#content ⇒ Object
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 |