Class: Bluepill::ProcessConditions::FileTime
- Inherits:
-
ProcessCondition
- Object
- ProcessCondition
- Bluepill::ProcessConditions::FileTime
- Defined in:
- lib/bluepill/process_conditions/file_time.rb
Instance Method Summary collapse
- #check(value) ⇒ Object
-
#initialize(options = {}) ⇒ FileTime
constructor
A new instance of FileTime.
- #run(_pid, _include_children) ⇒ Object
Methods inherited from ProcessCondition
Constructor Details
#initialize(options = {}) ⇒ FileTime
Returns a new instance of FileTime.
4 5 6 7 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 4 def initialize( = {}) @below = [:below] @filename = [:filename] end |
Instance Method Details
#check(value) ⇒ Object
15 16 17 18 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 15 def check(value) return false if value.nil? value < @below end |
#run(_pid, _include_children) ⇒ Object
9 10 11 12 13 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 9 def run(_pid, _include_children) Time.now - File.mtime(@filename) if File.exist?(@filename) rescue $ERROR_INFO end |