Class: Rake::CpuCounter

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/cpu_counter.rb

Overview

Based on a script at:

http://stackoverflow.com/questions/891537/ruby-detect-number-of-cpus-installed

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.countObject

:nodoc: all



7
8
9
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/cpu_counter.rb', line 7

def self.count
  new.count_with_default
end

Instance Method Details

#count_with_default(default = 4) ⇒ Object



11
12
13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/cpu_counter.rb', line 11

def count_with_default(default=4)
  count || default
rescue StandardError
  default
end