module Tablo

Extended Modules

Defined in:

column.cr
commons.cr
row.cr
table.cr
tablo.cr

Constant Summary

CONNECTORS_DOUBLE = "╔╦╗╠╬╣╚╩╝║║║═══"
CONNECTORS_DOUBLE_SINGLE = "╓╥╖╟╫╢╙╨╜║║║───"
CONNECTORS_HEAVY = "┏┳┓┣╋┫┗┻┛┃┃┃━━━"
CONNECTORS_HEAVY_LIGHT = "┎┰┒┠╂┨┖┸┚┃┃┃───"
CONNECTORS_LIGHT_HEAVY = "┍┯┑┝┿┥┕┷┙│││━━━"
CONNECTORS_SINGLE = "┌┬┐├┼┤└┴┘│││───"
CONNECTORS_SINGLE_DOUBLE = "╒╤╕╞╪╡╘╧╛│││═══"
CONNECTORS_SINGLE_DOUBLE_MIXED = "╔╤╗╟┼╢╚╧╝║│║═─═"
CONNECTORS_SINGLE_ROUNDED = "╭┬╮├┼┤╰┴╯│││───"

Predefined connectors strings, whose size is 15 characters (raise Tablo::ParamException otherwise), but the user is free to use its own string of connectors when instanciating a new Tablo::Table object.

The first 9 characters are corner or cross connectors, the first 3 correspond to the top line, the next 3 to a middle line and the last 3 to the bottom line.

The next 3 are vertical line connectors, one for each column type

The last 3 are horizontal line connectors, one for each line type

CONNECTORS_TEXT_CLASSIC = "+++++++++|||---"
CONNECTORS_TEXT_EXTENDED = "+++++++++!:!=-="
STYLE_ALL_BORDERS = "LC,MC,RC,TL,ML,BL"

Style string contains the initial of line or column types (case insensitive, may be separated for better readability, but not mandatory) :

  • lc : Left column
  • mc : middle columns
  • rc : right column
  • tl : Top line
  • ml : Middle lines
  • bl : bottom lines
STYLE_NO_BORDERS = "mcml"
STYLE_NO_MID_COL = "LCRCTLMLBL"
VERSION = "0.10.1"

Instance Method Summary

Instance Method Detail

def cast(x : Array(Array)) #

Casts a 2D array of some types to a Tablo::DataType, recursively calling itself with each array element as argument until conversion is complete


[View source]
def cast(x : Array) #

Casts a subarray of some types into an Array(Tablo::CellType)


[View source]
def connector(connectors, line : TLine, column : TColumn) #

Returns a corner or cross connector


[View source]
def connector(connectors, line : TLine) #

Returns a horizontal line connector, line type specific


[View source]
def connector(connectors, column : TColumn) #

Returns a vertical line connector, column type specific


[View source]
def fpjust(data : Array(Array(Tablo::CellType | Nil)), col, nbdec, mode) #

fpjust align floating point values on decimal separator

Parameters :

  • col : the column to be formatted
  • nbdec : Number of decimals (using printf %.[nbdec]f format)
  • mode allows for tuning output :
    • nil : mere printf formatting
    • 0 : non signficant zeroes removed and decimal point kept even if no more decimal digits
    • 1 : non signficant zeroes removed and decimal point also removed if no more decimal digits
    • 2 : like 1, but all blanks if value == zero
    • 3 : same as 0, but zero added after decimal point if no more decimal digits

[View source]
def validate(x : Array(Array(Array))) #

3D arrays and above not allowed !


[View source]
def validate(x : Array(Array)) #

Validates that the 2d Array argument can be converted to a DataType


[View source]
def validate(x) #

[View source]
def validate_connectors(connectors) #

Check the connectors string size : must be 15 characters long.


[View source]