Table
Inherits Reference < Object
Constructors
Can be initialized with an of cells: Array(Array(String | Nil)) or nothing and you can add rows of data later with add_rows Note: all rows of data must be the same length.
Instance methods
Adds a row of data. Note: this must have the same number of items as all the other rows that have been added.
Extracts Column objects from the provided data primarily for use use by this class, but you may find it useful too.
Formats the data into a textual table. By default it will:
- start each row with "| "
- end each row with " |"
- separate each item with " | " These defaults can be overridden by specifying :left_border, :right_border, or :divider (respectively) in the options.
By default it assumes the first row is a header. To disable the divider under the first row set options[:show_header] = false To change the character used for the divider set options[:header_divider] = <any single character>
Example: [["things", "stuff"],["a", "b"], ["c", nil]] Would become
| things | stuff |
|---|---|
| a | b |
| c |