Class: Biscuit::Monitor::Cinr
- Inherits:
-
Object
- Object
- Biscuit::Monitor::Cinr
- Defined in:
- lib/biscuit-monitor/cinr.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #foreground_color ⇒ Object
-
#initialize(level = 0) ⇒ Cinr
constructor
A new instance of Cinr.
- #message ⇒ Object
Constructor Details
#initialize(level = 0) ⇒ Cinr
Returns a new instance of Cinr.
10 11 12 |
# File 'lib/biscuit-monitor/cinr.rb', line 10 def initialize(level=0) @level = Integer(level || 0) end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
8 9 10 |
# File 'lib/biscuit-monitor/cinr.rb', line 8 def level @level end |
Instance Method Details
#foreground_color ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/biscuit-monitor/cinr.rb', line 18 def foreground_color case when @level > 24 then :green when (13..24).include?(@level) then :light_green when (8..12).include?(@level) then :yellow when (3..7).include?(@level) then :light_red when @level < 3 then :red else :white end end |
#message ⇒ Object
14 15 16 |
# File 'lib/biscuit-monitor/cinr.rb', line 14 def "CINR: #{@level}dBs".colorize(foreground_color) end |