diff options
| author | Adam Vandenberg | 2009-11-16 09:35:19 -0800 |
|---|---|---|
| committer | Adam Vandenberg | 2009-11-19 14:03:06 -0800 |
| commit | 4fbcf13e658eaa0b1a02185c05cd84c5fe7a2567 (patch) | |
| tree | 5c8607d3c40e02780d6b41f796ef6cc42e56f43a /Library | |
| parent | 83fc432eab54b12e93a62fa1800bced66c631aec (diff) | |
| download | brew-4fbcf13e658eaa0b1a02185c05cd84c5fe7a2567.tar.bz2 | |
Move some helper functions into Hardware
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/hardware.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 18d4e6665..b86e06e67 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -59,10 +59,24 @@ class Hardware def self.processor_count @@processor_count ||= `/usr/sbin/sysctl -n hw.ncpu`.to_i 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_64_bit? self.sysctl_bool("hw.cpu64bit_capable") end + + def self.bits + Hardware.is_64_bit? ? 64 : 32 + end protected def self.sysctl_bool(property) |
