Module: Vidibus::Sysinfo::Swap
- Extended by:
- Base
- Defined in:
- lib/vidibus/sysinfo/swap.rb
Overview
Returns used swap in megabytes.
Calls ‘free`
Class Method Summary collapse
Methods included from Base
Class Method Details
.command ⇒ Object
12 13 14 |
# File 'lib/vidibus/sysinfo/swap.rb', line 12 def command "free -m | grep Swap:" end |
.parse(output) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/vidibus/sysinfo/swap.rb', line 16 def parse(output) if output.match(/^Swap:\s+([\d\s]+)$/) numbers = $1.split(/\s+/) numbers[1].to_i end end |