Class: Cumuli::PS::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/cumuli/ps.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



14
15
16
# File 'lib/cumuli/ps.rb', line 14

def command
  @command
end

#pidObject (readonly)

Returns the value of attribute pid.



14
15
16
# File 'lib/cumuli/ps.rb', line 14

def pid
  @pid
end

#ppidObject (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_sObject



27
28
29
# File 'lib/cumuli/ps.rb', line 27

def to_s
  "#{pid} #{ppid} #{command}"
end