Class: Total::OSX

Inherits:
Object
  • Object
show all
Defined in:
lib/total/osx.rb

Overview

OSX specifics.

Instance Method Summary collapse

Instance Method Details

#memoryObject

Get the total in bytes

Raises:



15
16
17
18
19
20
21
22
23
24
# File 'lib/total/osx.rb', line 15

def memory
  begin
    `sysctl -a`.split("\n").each do |t|
      return t.split[1].to_i if t.start_with?('hw.memsize:')
    end
  rescue Errno::ENOENT => e
    raise CantDetect, e.message
  end
  raise CantDetect, 'Can\'t detect memory size via sysctl'
end