Class | Ruport::Formatter::Text |
In: |
lib/ruport/formatter/text.rb
|
Parent: | Formatter |
This class provides text output for Ruport‘s Row, Table, Group, and Grouping renderers
It handles things like automatically truncating tables that go off the edge of the screen in the console, proper column alignment, and pretty output that looks something like this:
+------------------------------+ | apple | banana | strawberry | +------------------------------+ | yes | no | yes | | yes | yes | red snapper | | what | the | red snapper | +------------------------------+
:max_col_width: Ordinal array of column widths. Set automatically but can be overridden.
:alignment: Defaults to left justify text and right justify numbers. Centers all fields when set to :center.
:table_width: Will truncate rows at this limit.
:show_table_headers: Defaults to true
:show_group_headers: Defaults to true
:ignore_table_width: When set to true, outputs full table without truncating it. Useful for file output.
Hook for setting available options using a template. See the template documentation for the available options and their format.
Generates the body for a grouping. Iterates through the groups and renders them using the group renderer.
Generates a formatted text row.
Defaults to numeric values being right justified, and other values being left justified. Can be changed to support centering of output by setting options.alignment to :center
Uses fit_to_width to truncate the row if necessary.
Generates the body of the text table.
Defaults to numeric values being right justified, and other values being left justified. Can be changed to support centering of output by setting options.alignment to :center
Uses fit_to_width to truncate the table if necessary.
Uses the column names from the given Data::Table to generate a table header.
Calls fit_to_width to truncate the table heading if necessary.
Generates the horizontal rule by calculating the total table width and then generating a bar that looks like this:
"+------------------+"
Used to calculate the max_col_widths array. Override this to tweak the automatic column size adjustments.