2009-09-02 13:17:15 -06:00
|
|
|
class Hardware
|
2013-03-10 17:33:06 +00:00
|
|
|
case RUBY_PLATFORM.downcase
|
|
|
|
when /darwin/
|
|
|
|
require 'os/mac/hardware'
|
|
|
|
extend MacOSHardware
|
|
|
|
when /linux/
|
|
|
|
require 'os/linux/hardware'
|
|
|
|
extend LinuxHardware
|
|
|
|
else
|
|
|
|
raise "The system `#{`uname`.chomp}' is not supported."
|
2009-09-02 13:17:15 -06:00
|
|
|
end
|
|
|
|
|
2009-11-16 09:35:19 -08:00
|
|
|
def self.cores_as_words
|
|
|
|
case Hardware.processor_count
|
|
|
|
when 1 then 'single'
|
|
|
|
when 2 then 'dual'
|
|
|
|
when 4 then 'quad'
|
|
|
|
else
|
|
|
|
Hardware.processor_count
|
|
|
|
end
|
|
|
|
end
|
2009-09-02 13:17:15 -06:00
|
|
|
|
2010-04-22 11:15:03 -07:00
|
|
|
def self.is_32_bit?
|
|
|
|
not self.is_64_bit?
|
|
|
|
end
|
|
|
|
|
2009-11-16 09:35:19 -08:00
|
|
|
def self.bits
|
|
|
|
Hardware.is_64_bit? ? 64 : 32
|
|
|
|
end
|
2009-09-02 13:17:15 -06:00
|
|
|
end
|