Class: IStats::Fan
Class Method Summary collapse
-
.all ⇒ Object
Call all functions (stats).
-
.delegate(stat) ⇒ Object
Delegate CLI command to function.
-
.fan_number ⇒ Object
Get the number of fans on system Calls a C method from FAN_STATS module.
-
.fans_speed ⇒ Object
Get and print the speed of each fan.
-
.print_fan_number ⇒ Object
Print number of fan(s).
-
.print_fan_speed(fanNum, speed) ⇒ Object
Actually print fan speed with Sparkline.
Methods included from FAN_STATS
Class Method Details
.all ⇒ Object
Call all functions (stats)
26 27 28 29 |
# File 'lib/iStats/fan.rb', line 26 def all print_fan_number fans_speed end |
.delegate(stat) ⇒ Object
Delegate CLI command to function
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/iStats/fan.rb', line 11 def delegate(stat) case stat when 'all' all when 'number', 'num' print_fan_number when 'speed' fans_speed else Command.help "Unknown stat for Fan: #{stat}" end end |
.fan_number ⇒ Object
Get the number of fans on system Calls a C method from FAN_STATS module
34 35 36 |
# File 'lib/iStats/fan.rb', line 34 def fan_number get_fan_number end |
.fans_speed ⇒ Object
Get and print the speed of each fan
46 47 48 49 50 51 52 53 |
# File 'lib/iStats/fan.rb', line 46 def fans_speed fanNum = fan_number (0..(fanNum-1)).each do |n| s = get_fan_speed(n) s = s.round unless s.nil? print_fan_speed(n, s) end end |
.print_fan_number ⇒ Object
Print number of fan(s)
40 41 42 |
# File 'lib/iStats/fan.rb', line 40 def print_fan_number Printer.print_item_line("Total fans in system", fan_number) end |
.print_fan_speed(fanNum, speed) ⇒ Object
Actually print fan speed with Sparkline
fanNum - The fan number speed - Fan speed in RPM
60 61 62 63 |
# File 'lib/iStats/fan.rb', line 60 def print_fan_speed(fanNum, speed) thresholds = [2500, 3500, 4500, 5500] Printer.print_item_line("Fan #{fanNum} speed", speed, " RPM", thresholds) end |