aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/hardware.rb
blob: ded0c9ccb3598476190e1a9e617d071f180e9395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Hardware
  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."
  end

  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

  def self.is_32_bit?
    not self.is_64_bit?
  end

  def self.bits
    Hardware.is_64_bit? ? 64 : 32
  end
end