Class: Cumuli::PS::Line
- Inherits:
-
Object
- Object
- Cumuli::PS::Line
- Defined in:
- lib/cumuli/ps.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#ppid ⇒ Object
readonly
Returns the value of attribute ppid.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(line) ⇒ Line
constructor
A new instance of Line.
- #to_s ⇒ Object
Constructor Details
#initialize(line) ⇒ Line
Returns a new instance of Line.
16 17 18 19 20 21 |
# File 'lib/cumuli/ps.rb', line 16 def initialize(line) elements = line.split @pid = elements.shift.to_i @ppid = elements.shift.to_i @command = elements.join(' ') end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
14 15 16 |
# File 'lib/cumuli/ps.rb', line 14 def command @command end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
14 15 16 |
# File 'lib/cumuli/ps.rb', line 14 def pid @pid end |
#ppid ⇒ Object (readonly)
Returns the value of attribute ppid.
14 15 16 |
# File 'lib/cumuli/ps.rb', line 14 def ppid @ppid end |
Instance Method Details
#<=>(other) ⇒ Object
23 24 25 |
# File 'lib/cumuli/ps.rb', line 23 def <=>(other) self.pid <=> other.pid end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/cumuli/ps.rb', line 27 def to_s "#{pid} #{ppid} #{command}" end |