module Vidibus::Sysinfo::Swap
Returns used swap in megabytes.
Calls `free`
Public Class Methods
command()
click to toggle source
# File lib/vidibus/sysinfo/swap.rb, line 24 def command "free -m | grep Swap:" end
parse(output)
click to toggle source
# File lib/vidibus/sysinfo/swap.rb, line 28 def parse(output) if output.match(/^Swap:\s+([\d\s]+)$/) numbers = $1.split(/\s+/) Result.new({ total: numbers[0].to_i, used: numbers[1].to_i, free: numbers[2].to_i }) end end