Class: Ruboty::Docker::Actions::Top
- Defined in:
- lib/ruboty/docker/actions/top.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Ruboty::Docker::Actions::Base
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruboty/docker/actions/top.rb', line 5 def call container = [:container_name] top = ::Docker::Container.get(container).top rows = [] top.each do |t| rows.push [t['PID'], t['USER'], t['COMMAND']] end table = ::Terminal::Table.new title: 'CONTAINER TOP', headings: ['PID', 'USER', 'COMMAND'], rows: rows table.style = { :padding_left => 0, :border_x => '', :border_y => ' ', :border_i => '' } .reply(table, code: true) rescue => e value = [e.class.name, e.].join("\n") .reply value ensure end |