Class: OsCtl::Cli::PidFinder
- Inherits:
-
Object
- Object
- OsCtl::Cli::PidFinder
- Defined in:
- lib/osctl/cli/pid_finder.rb
Instance Attribute Summary collapse
-
#finder ⇒ Object
readonly
protected
Returns the value of attribute finder.
Instance Method Summary collapse
- #find(pid) ⇒ Object
-
#initialize(header: true) ⇒ PidFinder
constructor
A new instance of PidFinder.
- #print(pid, ct, ctpid = '-', name = '-') ⇒ Object protected
Constructor Details
Instance Attribute Details
#finder ⇒ Object (readonly, protected)
Returns the value of attribute finder.
32 33 34 |
# File 'lib/osctl/cli/pid_finder.rb', line 32 def finder @finder end |
Instance Method Details
#find(pid) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/osctl/cli/pid_finder.rb', line 11 def find(pid) ret = finder.find(pid.to_i) if ret.nil? print(pid, '-') elsif ret.ctid == :host print(pid, '[host]', '-', ret.os_process.name) else print( pid, "#{ret.pool}:#{ret.ctid}", ret.os_process.ct_pid, ret.os_process.name ) end end |
#print(pid, ct, ctpid = '-', name = '-') ⇒ Object (protected)
34 35 36 |
# File 'lib/osctl/cli/pid_finder.rb', line 34 def print(pid, ct, ctpid = '-', name = '-') puts format('%-10s %-20s %-10s %s', pid.to_s, ct, ctpid.to_s, name) end |