class Ps_ef
Attributes
table[R]
zombies[R]
Public Class Methods
new(string = '')
click to toggle source
# File lib/Unix/Ps_ef.rb, line 12 def initialize(string = '') @table = {} decode(string) unless string.empty? end
Public Instance Methods
decode(string)
click to toggle source
# File lib/Unix/Ps_ef.rb, line 18 def decode(string) string.split("\n").each do |string| next if string =~ /UID\s+PID\s+PPID\s+C\s+STIME\s+TTY\s+TIME\s+CMD/ process = Ps_process.new(string) @table[process.pid] = process end @table.each_key do |key| entry = @table[key] @table[entry.ppid].children += 1 unless entry.ppid == 0 end end
have_more_children(number)
click to toggle source
# File lib/Unix/Ps_ef.rb, line 32 def have_more_children(number) array = [] @table.each_key do |key| next if @table[key].pid == 1 || @table[key].pid == 2 array << @table[key].pid if @table[key].children > number end array end