class Numeric
Public Instance Methods
duration()
click to toggle source
# File lib/notifu/mixins.rb, line 9 def duration secs = self.to_int mins = secs / 60 hours = mins / 60 days = hours / 24 if days > 0 "#{days}d, #{hours % 24}h, #{mins % 60}min, #{secs % 60}s" elsif hours > 0 "#{hours}h, #{mins % 60}min, #{secs % 60}s" elsif mins > 0 "#{mins}min, #{secs % 60}s" elsif secs >= 0 "#{secs}s" end end
to_state()
click to toggle source
# File lib/notifu/mixins.rb, line 26 def to_state case self.to_int when 0 return "OK" when 1 return "WARNING" when 2 return "CRITICAL" else return "UNKNOWN [#{self.to_s}]" end end