Class: Pvectl::Formatters::Table
- Defined in:
- lib/pvectl/formatters/table.rb
Overview
Formats data as a table using tty-table gem.
For collections: renders standard horizontal table with headers. For single resources (describe): renders vertical key-value layout.
Instance Method Summary collapse
-
#format(data, presenter, color_enabled: true, describe: false, **context) ⇒ String
Formats data as table output.
Instance Method Details
#format(data, presenter, color_enabled: true, describe: false, **context) ⇒ String
Formats data as table output.
33 34 35 36 37 38 39 40 41 |
# File 'lib/pvectl/formatters/table.rb', line 33 def format(data, presenter, color_enabled: true, describe: false, **context) pastel = ColorSupport.pastel(explicit_flag: color_enabled) if describe || !collection?(data) format_describe(data, presenter, pastel) else format_table(data, presenter, pastel, **context) end end |