Class: Barr::Blocks::IP
- Inherits:
-
Barr::Block
- Object
- Barr::Block
- Barr::Blocks::IP
- Defined in:
- lib/barr/blocks/ip.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
Attributes inherited from Barr::Block
#align, #bgcolor, #fgcolor, #icon, #interval, #output
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ IP
constructor
A new instance of IP.
- #update! ⇒ Object
Methods inherited from Barr::Block
#<<, #colors, #destroy, #destroy!, #draw, #reassign_deprecated_option, #update
Constructor Details
#initialize(opts = {}) ⇒ IP
Returns a new instance of IP.
9 10 11 12 13 |
# File 'lib/barr/blocks/ip.rb', line 9 def initialize(opts = {}) super @device = opts[:device] || 'lo' @version = opts[:ipv6] ? 'inet6' : 'inet' end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
7 8 9 |
# File 'lib/barr/blocks/ip.rb', line 7 def device @device end |
Instance Method Details
#update! ⇒ Object
15 16 17 18 19 |
# File 'lib/barr/blocks/ip.rb', line 15 def update! ip = sys_cmd.split('/').first @output = "#{@device} > #{ip}" end |