Class: Appydave::Tools::Jump::Formatters::TableFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/appydave/tools/jump/formatters/table_formatter.rb

Overview

Table formatter for human-readable terminal output with colors

Constant Summary collapse

COLORS =

ANSI color codes

{
  reset: "\e[0m",
  bold: "\e[1m",
  dim: "\e[2m",
  red: "\e[31m",
  green: "\e[32m",
  yellow: "\e[33m",
  blue: "\e[34m",
  magenta: "\e[35m",
  cyan: "\e[36m",
  white: "\e[37m"
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#data, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Appydave::Tools::Jump::Formatters::Base

Instance Method Details

#formatString

Format data as a colored table

Returns:

  • (String)

    Formatted table



26
27
28
29
30
31
32
# File 'lib/appydave/tools/jump/formatters/table_formatter.rb', line 26

def format
  return format_error unless success?
  return format_info if info_result?
  return format_empty if results.empty?

  format_results
end