Class: Polars::Ubuntu::Hardware

Inherits:
Object
  • Object
show all
Defined in:
lib/polars/ubuntu/hardware.rb

Overview

Hardware Class

Instance Method Summary collapse

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