Class: Eye::Checker::FileCTime
- Inherits:
-
Eye::Checker
- Object
- Eye::Checker
- Eye::Checker::FileCTime
- Defined in:
- lib/eye/checker/file_ctime.rb
Constant Summary
Constants inherited from Eye::Checker
Instance Attribute Summary
Attributes inherited from Eye::Checker
#check_count, #options, #pid, #process, #type, #value, #values
Instance Method Summary collapse
- #get_value ⇒ Object
- #good?(value) ⇒ Boolean
- #human_value(value) ⇒ Object
-
#initialize(*args) ⇒ FileCTime
constructor
A new instance of FileCTime.
Methods inherited from Eye::Checker
#check, #check_name, create, #defer, #fire, get_class, #get_value_safe, #inspect, #last_human_values, #logger_sub_tag, #logger_tag, #max_tries, #min_tries, name_and_class, #previous_value, register, requires, #run_in_process_context, validate!
Methods included from Dsl::Validation
Constructor Details
#initialize(*args) ⇒ FileCTime
Returns a new instance of FileCTime.
8 9 10 11 |
# File 'lib/eye/checker/file_ctime.rb', line 8 def initialize(*args) super self.file = process.(file) if process && file end |
Instance Method Details
#get_value ⇒ Object
13 14 15 |
# File 'lib/eye/checker/file_ctime.rb', line 13 def get_value File.ctime(file) rescue nil end |
#good?(value) ⇒ Boolean
25 26 27 |
# File 'lib/eye/checker/file_ctime.rb', line 25 def good?(value) value.to_i > previous_value.to_i end |
#human_value(value) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/eye/checker/file_ctime.rb', line 17 def human_value(value) if value.nil? 'Err' else value.strftime('%H:%M') end end |