Module: Host::Linux::Memory

Includes:
Hashifier
Defined in:
lib/host/linux/memory.rb

Overview

Implements the retrieving of memory information on Linux systems.

Instance Method Summary collapse

Methods included from Hashifier

#hashify

Instance Method Details

#buffersObject

Sugar. Equivalent to Host::Memory.get(‘Buffers’) with implicit transformation to integer (in kB)



26
27
28
# File 'lib/host/linux/memory.rb', line 26

def buffers
  as_integer @info[:Buffers]
end

#freeObject

Sugar. Equivalent to Host::Memory.get(‘MemFree’) with implicit transformation to integer (in kB)



20
21
22
# File 'lib/host/linux/memory.rb', line 20

def free
  as_integer @info[:MemFree]
end

#get(key) ⇒ Object

Retrieves specific information for the given key (as some exotic information in /proc/meminfo, for instance).



32
33
34
# File 'lib/host/linux/memory.rb', line 32

def get(key)
  @info[key.to_sym]
end

#totalObject

Just sugar. Equivalent to Host::Memory.get(‘MemTotal’) with implicit transformation to integer (in kB)



14
15
16
# File 'lib/host/linux/memory.rb', line 14

def total
  as_integer @info[:MemTotal]
end