Class: Invoker::ProcessPrinter
- Inherits:
-
Object
- Object
- Invoker::ProcessPrinter
- Defined in:
- lib/invoker/process_printer.rb
Constant Summary collapse
- MAX_COLUMN_WIDTH =
40
Instance Attribute Summary collapse
-
#list_response ⇒ Object
Returns the value of attribute list_response.
Instance Method Summary collapse
-
#initialize(list_response) ⇒ ProcessPrinter
constructor
A new instance of ProcessPrinter.
- #print_raw_text ⇒ Object
- #print_table ⇒ Object
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_response ⇒ Object
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
#print_raw_text ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/invoker/process_printer.rb', line 22 def print_raw_text list_response.processes.each do |process| Formatador.display_line("[bold]Process Name : #{process.process_name}[/]") Formatador.indent { Formatador.display_line("Dir : #{process.dir}") if process.pid Formatador.display_line("PID : #{process.pid}") else Formatador.display_line("PID : Not Running") end Formatador.display_line("Port : #{process.port}") Formatador.display_line("Command : #{process.shell_command}") } end end |
#print_table ⇒ Object
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 |