Class: ProcessInfo
- Inherits:
-
Object
- Object
- ProcessInfo
- Defined in:
- lib/vcseif/utils/proctbl.rb
Instance Attribute Summary collapse
-
#cmdline ⇒ Object
Returns the value of attribute cmdline.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#ppid ⇒ Object
Returns the value of attribute ppid.
-
#started ⇒ Object
Returns the value of attribute started.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
-
#initialize(fields) ⇒ ProcessInfo
constructor
A new instance of ProcessInfo.
- #to_s ⇒ Object
Constructor Details
#initialize(fields) ⇒ ProcessInfo
Returns a new instance of ProcessInfo.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vcseif/utils/proctbl.rb', line 17 def initialize(fields) @uid = 0 # default to a Windows "safe" value user_field = fields[0] @pid = fields[1].to_i @ppid = fields[2].to_i junk = fields[3] @started = fields[4] @cmdline = fields[5] begin uid = user_field.to_i @uid = uid rescue Exception => ex begin require 'etc' user = Etc.getpwnam(user_field) @uid = user.uid.to_i rescue # do nothing, we'll limp along with the default value established earlier end end end |
Instance Attribute Details
#cmdline ⇒ Object
Returns the value of attribute cmdline.
15 16 17 |
# File 'lib/vcseif/utils/proctbl.rb', line 15 def cmdline @cmdline end |
#pid ⇒ Object
Returns the value of attribute pid.
15 16 17 |
# File 'lib/vcseif/utils/proctbl.rb', line 15 def pid @pid end |
#ppid ⇒ Object
Returns the value of attribute ppid.
15 16 17 |
# File 'lib/vcseif/utils/proctbl.rb', line 15 def ppid @ppid end |
#started ⇒ Object
Returns the value of attribute started.
15 16 17 |
# File 'lib/vcseif/utils/proctbl.rb', line 15 def started @started end |
#uid ⇒ Object
Returns the value of attribute uid.
15 16 17 |
# File 'lib/vcseif/utils/proctbl.rb', line 15 def uid @uid end |
Instance Method Details
#to_s ⇒ Object
39 40 41 |
# File 'lib/vcseif/utils/proctbl.rb', line 39 def to_s "%5s %5s %5s %12s %s" % [@pid, @uid, @ppid, @started, @cmdline] end |