Class: Co2Notify::Status::VeryHigh

Inherits:
Base
  • Object
show all
Defined in:
lib/co2-notify/status.rb

Instance Attribute Summary

Attributes inherited from Base

#co2, #config, #previous, #time

Instance Method Summary collapse

Methods inherited from Base

#initialize, #type_changed?

Constructor Details

This class inherits a constructor from Co2Notify::Status::Base

Instance Method Details

#changed?(new_status) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/co2-notify/status.rb', line 34

def changed?(new_status)
  new_status.is_a?(Empty) ||
    new_status.is_a?(Normal) ||
    (new_status.is_a?(VeryHigh) && new_status.co2 > co2)
end

#colorObject



30
31
32
# File 'lib/co2-notify/status.rb', line 30

def color
  :red
end

#messageObject



26
27
28
# File 'lib/co2-notify/status.rb', line 26

def message
  "#{hc_mention}CO₂ level is very high - #{co2}. Please open the windows!"
end

#timeoutObject



40
41
42
# File 'lib/co2-notify/status.rb', line 40

def timeout
  previous.is_a?(Empty) || previous.is_a?(Normal) ? cooldown : super
end