Class: Invoker::ProcessPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/invoker/process_printer.rb

Constant Summary collapse

MAX_COLUMN_WIDTH =
40

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list_response) ⇒ ProcessPrinter

Returns a new instance of ProcessPrinter.



6
7
8
# File 'lib/invoker/process_printer.rb', line 6

def initialize(list_response)
  self.list_response = list_response
end

Instance Attribute Details

#list_responseObject

Returns the value of attribute list_response.



4
5
6
# File 'lib/invoker/process_printer.rb', line 4

def list_response
  @list_response
end

Instance Method Details



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/invoker/process_printer.rb', line 10

def print_table
  hash_with_colors = []
  list_response.processes.each do |process|
    if process.pid
      hash_with_colors << colorize_hash(process, "green")
    else
      hash_with_colors << colorize_hash(process, "light_black")
    end
  end
  Formatador.display_compact_table(hash_with_colors)
end