class Checkups::Performance
Attributes
error_limit[R]
warning_limit[R]
Public Class Methods
frequency()
click to toggle source
# File lib/checkups/performance.rb, line 5 def self.frequency :never end
new(verbose: false, name: nil, warning_limit: 1800, error_limit: 3600)
click to toggle source
Calls superclass method
Checkups::Checkup::new
# File lib/checkups/performance.rb, line 11 def initialize(verbose: false, name: nil, warning_limit: 1800, error_limit: 3600) super(verbose: verbose) @name = name @warning_limit = warning_limit @error_limit = error_limit ok end
Public Instance Methods
check() { || ... }
click to toggle source
# File lib/checkups/performance.rb, line 19 def check start_time = Time.now.to_i yield check_elapsed(Time.now.to_i - start_time) end
check_elapsed(elapsed)
click to toggle source
# File lib/checkups/performance.rb, line 25 def check_elapsed(elapsed) if warning_limit <= elapsed && elapsed < error_limit warning "#{name} took longer than #{warning_limit}s: #{elapsed}s" elsif error_limit <= elapsed error "#{name} took longer than #{error_limit}s: #{elapsed}s" else ok end end