Class: Host::Memory
- Inherits:
-
Object
- Object
- Host::Memory
- Defined in:
- lib/host/memory.rb
Overview
Class representing memory in a system. As Host::Processor, this class is also operating system dependent, which means that different information is provided depending on your OS.
The minimum information provided for the supported operating systems is:
-
total memory
-
free memory
Other information can be retrieved via the Host::Processor.get method which returns the information associated with the given key (depending on your OS).
Example usage:
Host::Memory.total #=> 4023256
Host::Memory.free #=> 2115874
# For specific information (as in +/proc/meminfo+ for instance),
# you can use the +get+ method
Host::Memory.get('KernelStack') #=> "1080 kB"
Class Method Summary collapse
-
.extend_memory ⇒ Object
Acts differently dependending on the operating systems.
- .memory_info ⇒ Object
Class Method Details
.extend_memory ⇒ Object
Acts differently dependending on the operating systems. Raises NotSupportedOperatingSystem
if we cannot recognize the OS.
33 34 35 36 37 38 |
# File 'lib/host/memory.rb', line 33 def extend_memory case Host.os when :linux then extend Linux::Memory # other os... end end |
.memory_info ⇒ Object
27 28 29 |
# File 'lib/host/memory.rb', line 27 def memory_info @info ||= [] end |