Module: Specjour::CPU

Defined in:
lib/specjour/cpu.rb

Class Method Summary collapse

Class Method Details

.coresObject



3
4
5
6
7
8
9
10
11
# File 'lib/specjour/cpu.rb', line 3

def self.cores
  case RUBY_PLATFORM
  when /darwin/
    command('hostinfo') =~ /^(\d+).+logically/
    $1.to_i
  when /linux/
    command('grep --count processor /proc/cpuinfo').to_i
  end
end