class Invoker::ProcessPrinter

Constants

MAX_COLUMN_WIDTH

Attributes

list_response[RW]

Public Class Methods

new(list_response) click to toggle source
# File lib/invoker/process_printer.rb, line 6
def initialize(list_response)
  self.list_response = list_response
end

Public Instance Methods

print_table() click to toggle source

Private Instance Methods

colored_string(string, color) click to toggle source
# File lib/invoker/process_printer.rb, line 35
def colored_string(string, color)
  string = string.to_s
  if string.length > MAX_COLUMN_WIDTH
    string = "#{string[0..MAX_COLUMN_WIDTH]}.."
  end
  "[#{color}]#{string}[/]"
end
colorize_hash(process, color) click to toggle source
# File lib/invoker/process_printer.rb, line 24
def colorize_hash(process, color)
  hash_with_colors = {}

  hash_with_colors['dir'] = colored_string(process.dir, color)
  hash_with_colors['pid'] = colored_string(process.pid || 'Not Running', color)
  hash_with_colors['port'] = colored_string(process.port, color)
  hash_with_colors['shell_command'] = colored_string(process.shell_command, color)
  hash_with_colors['process_name'] = colored_string(process.process_name, color)
  hash_with_colors
end