module AsciiParadise::AsciiTable::TableHelper

Public Instance Methods

table(header = [], *rows, &block) click to toggle source
#

table

Create a new table with this method. See the sample/ directory containing code for this.

The input header will be the left and right header. These will be explicitly an Array.

#
# File lib/ascii_paradise/asciitable/table_helper.rb, line 22
def table(header = [], *rows, &block)
  unless header.is_a? Array
    header = header.to_a
  end
  # ===================================================================== #
  # Instantiate a new table next.
  # ===================================================================== #
  AsciiParadise::AsciiTable.new(
    headings: header,
    rows:     rows,
    &block
  )
end