class ImpatientWatchdog

Constants

MOODS

Public Class Methods

new(config) click to toggle source
# File lib/impatient_watchdog.rb, line 5
def initialize(config)
  @mood_cutoffs_in_hours = config['mood_cutoffs_in_hours']
end

Public Instance Methods

mood(options) click to toggle source
# File lib/impatient_watchdog.rb, line 9
def mood(options)
  wait_time = minutes_ago(options[:waiting_since])
  return "enraged" if wait_time > @mood_cutoffs_in_hours['enraged']
  return "angry" if wait_time > @mood_cutoffs_in_hours['angry']
  return "neutral" if wait_time > @mood_cutoffs_in_hours['neutral']
  "happy"
end

Private Instance Methods

minutes_ago(time) click to toggle source
# File lib/impatient_watchdog.rb, line 19
def minutes_ago(time)
  (Time.now - time) / 60.0 / 60.0
end