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
-
#buffers(refresh = false) ⇒ Object
Sugar.
-
#free(refresh = false) ⇒ Object
Sugar.
-
#get(key) ⇒ Object
Retrieves specific information for the given key (as some exotic information in
/proc/meminfo
, for instance). -
#refresh ⇒ Object
Refreshes your memory information, reading
/proc/meminfo
once again. -
#total(refresh = false) ⇒ Object
Just sugar.
Methods included from Hashifier
Instance Method Details
#buffers(refresh = false) ⇒ Object
Sugar. Equivalent to Host::Memory.get(‘Buffers’) with implicit transformation to integer (in kB)
31 32 33 34 |
# File 'lib/host/linux/memory.rb', line 31 def buffers(refresh=false) get_meminfo(true) if refresh as_integer @info[:Buffers] end |
#free(refresh = false) ⇒ Object
Sugar. Equivalent to Host::Memory.get(‘MemFree’) with implicit transformation to integer (in kB).
24 25 26 27 |
# File 'lib/host/linux/memory.rb', line 24 def free(refresh=false) get_meminfo(true) if refresh as_integer @info[:MemFree] end |
#get(key) ⇒ Object
Retrieves specific information for the given key (as some exotic information in /proc/meminfo
, for instance).
44 45 46 |
# File 'lib/host/linux/memory.rb', line 44 def get(key) @info[key.to_sym] end |
#refresh ⇒ Object
Refreshes your memory information, reading /proc/meminfo
once again
37 38 39 40 |
# File 'lib/host/linux/memory.rb', line 37 def refresh get_meminfo(true) self end |
#total(refresh = false) ⇒ Object
17 18 19 20 |
# File 'lib/host/linux/memory.rb', line 17 def total(refresh=false) get_meminfo(true) if refresh as_integer @info[:MemTotal] end |