Sha256: 850283db057a0658d26ec84e175c0c0b9354292eaa761bc20ab84f90378f1d66

Contents?: true

Size: 479 Bytes

Versions: 42

Compression:

Stored size: 479 Bytes

Contents

class PS
	
	include RunCommand
	
	command :ps
	
	def command_line_opts
		"aux"
	end
	
	def data
		headers = false
		command_output.split("\n").map {|line| line.split("\s") }.inject([]) do |output,line|
			if !headers
				headers = 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[headers[idx]] = itm
				end
				output << pkt
			end
			output
		end
	end
	
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
city-watch-0.7.9 lib/city_watch/commands/ps.rb
city-watch-0.7.8 lib/city_watch/commands/ps.rb
city-watch-0.7.7 lib/city_watch/commands/ps.rb
city-watch-0.7.6 lib/city_watch/commands/ps.rb
city-watch-0.7.5 lib/city_watch/commands/ps.rb
city-watch-0.7.4 lib/city_watch/commands/ps.rb
city-watch-0.7.3 lib/city_watch/commands/ps.rb
city-watch-0.7.2 lib/city_watch/commands/ps.rb
city-watch-0.7.1 lib/city_watch/commands/ps.rb
city-watch-0.7.0 lib/city_watch/commands/ps.rb
city-watch-0.6.9 lib/city_watch/commands/ps.rb
city-watch-0.6.8 lib/city_watch/commands/ps.rb
city-watch-0.6.7 lib/city_watch/commands/ps.rb
city-watch-0.6.6 lib/city_watch/commands/ps.rb
city-watch-0.6.5 lib/city_watch/commands/ps.rb
city-watch-0.6.4 lib/city_watch/commands/ps.rb
city-watch-0.6.3 lib/city_watch/commands/ps.rb
city-watch-0.6.2 lib/city_watch/commands/ps.rb
city-watch-0.6.1 lib/city_watch/commands/ps.rb
city-watch-0.6.0 lib/city_watch/commands/ps.rb