Class: TermDump::Process
- Inherits:
-
Object
- Object
- TermDump::Process
- Defined in:
- lib/termdump/process.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#ppid ⇒ Object
Returns the value of attribute ppid.
-
#stat ⇒ Object
Returns the value of attribute stat.
Instance Method Summary collapse
-
#initialize(pid, ppid, stat, command) ⇒ Process
constructor
A new instance of Process.
- #is_child_of(process) ⇒ Object
- #is_in_foreground ⇒ Object
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
#command ⇒ Object
Returns the value of attribute command.
3 4 5 |
# File 'lib/termdump/process.rb', line 3 def command @command end |
#pid ⇒ Object
Returns the value of attribute pid.
3 4 5 |
# File 'lib/termdump/process.rb', line 3 def pid @pid end |
#ppid ⇒ Object
Returns the value of attribute ppid.
3 4 5 |
# File 'lib/termdump/process.rb', line 3 def ppid @ppid end |
#stat ⇒ Object
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_foreground ⇒ Object
11 12 13 |
# File 'lib/termdump/process.rb', line 11 def is_in_foreground @stat.start_with?('S') && @stat.include?('+') end |