Class: IStats::Cpu
- Inherits:
-
Object
- Object
- IStats::Cpu
- Defined in:
- lib/iStats/cpu.rb
Overview
CPU Stats Extend CPU_STATS C module (ext/osx_stats/smc.c)
Constant Summary
Constants included from Color
Class Method Summary collapse
Methods included from Color
Methods included from CPU_STATS
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/iStats/cpu.rb', line 20 def all cpu_temperature end |
.cpu_temperature ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/iStats/cpu.rb', line 24 def cpu_temperature t = get_cpu_temp = "CPU temp: #{t}°C " list = [0, 30, 55, 80, 100, 130] sparkline = Sparkr.sparkline(list) do |tick, count, index| if index.between?(0, 5) and t > 90 flash_red(tick) elsif index.between?(0, 1) green(tick) elsif index.between?(2, 3) and t > 50 light_yellow(tick) elsif index == 4 and t > 70 yellow(tick) elsif index == 5 and t > 80 red(tick) else tick end end puts + sparkline end |
.delegate(stat) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/iStats/cpu.rb', line 9 def delegate(stat) case stat when 'all' all when 'temp', 'temperature' cpu_temperature else Command.help "Unknown stat for CPU: #{stat}" end end |