Class: Total::Linux
- Inherits:
-
Object
- Object
- Total::Linux
- Defined in:
- lib/total/linux.rb
Overview
Linux specifics.
Instance Method Summary collapse
-
#memory ⇒ Object
Get the total in bytes.
Instance Method Details
#memory ⇒ Object
Get the total in bytes
34 35 36 37 38 39 40 |
# File 'lib/total/linux.rb', line 34 def memory raise CantDetect unless File.exist?('/proc/meminfo') IO.readlines('/proc/meminfo').each do |t| return t.split(/ +/)[1].to_i * 1024 if t.start_with?('MemTotal:') end raise CantDetect, 'Can\'t detect memory size at /proc/meminfo' end |