Class: Co2Notify::Status::High
- Inherits:
-
Base
- Object
- Base
- Co2Notify::Status::High
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?
Instance Method Details
#changed?(new_status) ⇒ Boolean
54
55
56
57
58
59
|
# File 'lib/co2-notify/status.rb', line 54
def changed?(new_status)
new_status.is_a?(Empty) ||
new_status.is_a?(Normal) ||
(new_status.is_a?(High) && new_status.co2 > co2) ||
new_status.is_a?(VeryHigh)
end
|
#color ⇒ Object
50
51
52
|
# File 'lib/co2-notify/status.rb', line 50
def color
previous.is_a?(High) ? :red : :yellow
end
|
#message ⇒ Object
46
47
48
|
# File 'lib/co2-notify/status.rb', line 46
def message
"#{hc_mention}CO₂ level is high - #{co2}. Please open the windows!"
end
|
#timeout ⇒ Object
61
62
63
|
# File 'lib/co2-notify/status.rb', line 61
def timeout
previous.is_a?(Empty) || previous.is_a?(Normal) ? cooldown : super
end
|