class Ps_Aux @@ps_aux def initialize @@ps_aux = `/bin/ps aux | /usr/bin/awk -F: '{ print $1,$2,$3 }'` end def parse @@ps_aux = @@ps_aux.split("\n") $return = {} $i = 0 @@ps_aux.each do |ps| ps = ps.split(" ") if ps[0] != "USER" $i += 1 $return[$i] = { 'user' => ps[0], 'pid' => ps[1], 'cpu' => ps[2], 'mem' => ps[3], 'started' => ps[9], 'time' => ps[11] } end end $return end end