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.
5 6 7 8 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 5 def initialize( = {}) @below = [:below] @filename = [:filename] end |
Instance Method Details
#check(value) ⇒ Object
20 21 22 23 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 20 def check(value) return false if value.nil? return value < @below end |
#run(pid, include_children) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/bluepill/process_conditions/file_time.rb', line 10 def run(pid, include_children) if File.exists?(@filename) Time.now()-File::mtime(@filename) else nil end rescue $! end |