class Barr::Blocks::CPU
Public Instance Methods
update!()
click to toggle source
# 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
Private Instance Methods
sys_cmd()
click to toggle source
# File lib/barr/blocks/cpu.rb, line 15 def sys_cmd `top -bn1 | grep 'Cpu(s)'`.chomp end