Module: AsciiParadise::AsciiTable::TableHelper

Defined in:
lib/ascii_paradise/asciitable/table_helper.rb

Overview

The TableHelper module.

Instance Method Summary collapse

Instance Method Details

#table(header = [], *rows, &block) ⇒ Object

#

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.

#


22
23
24
25
26
27
28
29
30
31
32
33
34
# 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