Class: TermDump::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/termdump/process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pid, ppid, stat, command) ⇒ Process

Returns a new instance of Process.



4
5
6
7
8
9
# File 'lib/termdump/process.rb', line 4

def initialize pid, ppid, stat, command
  @pid = pid
  @ppid = ppid
  @stat = stat
  @command = command
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/termdump/process.rb', line 3

def command
  @command
end

#pidObject

Returns the value of attribute pid.



3
4
5
# File 'lib/termdump/process.rb', line 3

def pid
  @pid
end

#ppidObject

Returns the value of attribute ppid.



3
4
5
# File 'lib/termdump/process.rb', line 3

def ppid
  @ppid
end

#statObject

Returns the value of attribute stat.



3
4
5
# File 'lib/termdump/process.rb', line 3

def stat
  @stat
end

Instance Method Details

#is_child_of(process) ⇒ Object



15
16
17
# File 'lib/termdump/process.rb', line 15

def is_child_of process
  @ppid == process.pid
end

#is_in_foregroundObject



11
12
13
# File 'lib/termdump/process.rb', line 11

def is_in_foreground
  @stat.start_with?('S') && @stat.include?('+')
end