Class: PS
Instance Method Summary
collapse
Methods included from RunCommand
#command_line, #command_output, included, #options, #set_opts, #supported?
Instance Method Details
#command_line_opts ⇒ Object
7
8
9
|
# File 'lib/city_watch/commands/ps.rb', line 7
def command_line_opts
"aux"
end
|
#data ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/city_watch/commands/ps.rb', line 11
def data
= false
command_output.split("\n").map {|line| line.split("\s") }.inject([]) do |output,line|
if !
= line.map {|hdr| hdr.downcase.to_sym}
else
pkt = {}
cmd = line.slice!(10,line.size-1)
line << cmd.join(" ")
line.each_with_index do |itm,idx|
pkt[[idx]] = itm
end
output << pkt
end
output
end
end
|