Class: Polars::Ubuntu::Hardware
- Inherits:
-
Object
- Object
- Polars::Ubuntu::Hardware
- Defined in:
- lib/polars/ubuntu/hardware.rb
Overview
Hardware Class
Instance Method Summary collapse
-
#total_cores(proc_file = "/proc/cpuinfo") ⇒ Object
Get total cores.
Instance Method Details
#total_cores(proc_file = "/proc/cpuinfo") ⇒ Object
Get total cores
26 27 28 |
# File 'lib/polars/ubuntu/hardware.rb', line 26 def total_cores(proc_file = "/proc/cpuinfo") File.readlines(proc_file).count { |line| line =~ /^processor\s+:\s+\d+/ } end |