Class: Biscuit::Monitor::Rssi
- Inherits:
-
Object
- Object
- Biscuit::Monitor::Rssi
- Defined in:
- lib/biscuit-monitor/rssi.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #foreground_color ⇒ Object
-
#initialize(level = 0) ⇒ Rssi
constructor
A new instance of Rssi.
- #message ⇒ Object
Constructor Details
#initialize(level = 0) ⇒ Rssi
Returns a new instance of Rssi.
10 11 12 |
# File 'lib/biscuit-monitor/rssi.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/rssi.rb', line 8 def level @level end |
Instance Method Details
#foreground_color ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/biscuit-monitor/rssi.rb', line 18 def foreground_color case when @level > -50 then :green when @level < -100 then :red else :yellow end end |
#message ⇒ Object
14 15 16 |
# File 'lib/biscuit-monitor/rssi.rb', line 14 def "RSSI: #{@level}dBs".colorize(foreground_color) end |