Module DBI::Utils::TableFormatter
In: lib/dbi/utils/tableformatter.rb

Formats a resultset in a textual table, suitable for printing.



Public Class methods

Perform the formatting.

  • header: table headers, as you‘d expect they correspond to each column in the row.
  • rows: array of array (or DBI::Row) which represent the data.
  • header_orient: jusification of the header. :left, :right, or :center.
  • rows_orient: justification of the rows. same as header_orient.
  • indent: number of spaces to indent each line in the output.
  • cellspace: number of spaces to pad the cell on the left and right.
  • pagebreak_after: introduce a pagebreak each n rows.
  • output: object that responds to `<<` which will contain the output. Default is STDOUT.

If a block is provided, output will be yielded each row if pagebreak is nil, otherwise it will be yielded when the output is complete.