class Crst::Table

Overview

Represents a table with header and data rows

Tables can be created from simple tables, grid tables, or list-table directives in RST. Each cell contains plain text.

Example:

# RST list-table:
# .. list-table::
#    :header-rows: 1
#
#    * - Name
#      - Age
#    * - Alice
#      - 30

table = Crst::Table.new
table.header = [["Name", "Age"]]
table.rows = [["Alice", "30"], ["Bob", "25"]]

Defined in:

crst/nodes.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(header : Array(Array(String)) = [] of Array(String), rows : Array(Array(String)) = [] of Array(String)) #

[View source]

Instance Method Detail

def header : Array(Array(String)) #

Header rows of the table (optional)


[View source]
def header=(header : Array(Array(String))) #

Header rows of the table (optional)


[View source]
def rows : Array(Array(String)) #

Data rows of the table


[View source]
def rows=(rows : Array(Array(String))) #

Data rows of the table


[View source]