Class: Barr::Blocks::CPU

Inherits:
Barr::Block show all
Defined in:
lib/barr/blocks/cpu.rb

Instance Attribute Summary

Attributes inherited from Barr::Block

#align, #bgcolor, #fgcolor, #icon, #interval, #output

Instance Method Summary collapse

Methods inherited from Barr::Block

#<<, #colors, #destroy, #destroy!, #draw, #initialize, #reassign_deprecated_option, #update

Constructor Details

This class inherits a constructor from Barr::Block

Instance Method Details

#update!Object



7
8
9
10
11
# File 'lib/barr/blocks/cpu.rb', line 7

def update!
  idle = sys_cmd.scan(/(\d{1,3}\.\d) id/).flatten.first.to_f

  @output = "#{(100 - idle).round(1)}%"
end