Sha256: 870f490de952790cb50ac1e8f409b8b0b27bf5f11c18b6b6b9db5a31c64463f9
Contents?: true
Size: 496 Bytes
Versions: 1
Compression:
Stored size: 496 Bytes
Contents
class PS include RunCommand command :ps def command_line_opts "aux" end def data headers = false output = [] command_output.split("\n").map {|line| line.split("\s") }.each do |line| if !headers headers = line.map {|hdr| hdr.downcase.to_sym} next end next unless headers pkt = {} cmd = line.slice!(10,line.size-1) line << cmd.join(" ") line.each_with_index do |itm,idx| pkt[headers[idx]] = itm end output << pkt end output end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
city-watch-0.3.0 | lib/city_watch/commands/ps.rb |