struct Tablo::Border

Overview

Border struct allows to create frames around rows and columns, using ascii and/or graphic characters (See Table for usage)

A border is defined by its name (see predefined constants below) or by a string of 16 characters, each of them representing a "connector" such as those below, or the absence of connector if the letter E (upcase) is used.

For example, the string "E EE EE EE E───" is how the ReducedModern style is defined.

Examples of text or graphic connectors:

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

Mixed graphic character sets, such as :

| Name                           | 16 chars string  |
| ------------------------------ | ---------------  |
| CONNECTORS_SINGLE_DOUBLE_MIXED | ╔╤╗╟┼╢╚╧╝║│║═─═- |

are not correctly rendered.

Below is a detailed representation of each position and meaning :

Pos Connector name     Example (using Fancy border name string)
--- --------------     ----------------------------------------
 0  top_left           "┌"
 1  top_mid            "┬"
 2  top_right          "┐"

 3  mid_left           "├"
 4  mid_mid            "┼"
 5  mid_right          "┤"

 6  bottom_left        "└"
 7  bottom_mid         "┴"
 8  bottom_right       "┘"

 9  vdiv_left          "│"
10  vdiv_mid           ":"
11  vdiv_right         "│"

12  hdiv_tbs           "─"     (title or top or bottom or summary)
13  hdiv_grp           "−"     (group)
14  hdiv_hdr           "-"     (header)
15  hdiv_bdy           "⋅"     (body)

Predefined borders are :

| name          | 16 chars string  |
| ------------- | ---------------- |
| Ascii         | +++++++++|||---- |
| ReducedAscii  | E EE EE EE E---- |
| ReducedModern | E EE EE EE E──── |
| Markdown      |    |||   |||  -  |
| Modern        | ┌┬┐├┼┤└┴┘│││──── |
| Fancy         | ╭┬╮├┼┤╰┴╯│:│─−-⋅ |
| Blank         | EEEEEEEEEEEEEEEE |

A border can be styled by a user defined proc, of type BorderStyler allowing for colorized output, either by using ANSI sequences or "colorize" module (default: no style)

Defined in:

border.cr

Constant Summary

PREDEFINED_BORDERS = {BorderName::Ascii => "+++++++++|||----", BorderName::ReducedAscii => "E EE EE EE E----", BorderName::Modern => "┌┬┐├┼┤└┴┘│││────", BorderName::ReducedModern => "E EE EE EE E────", BorderName::Markdown => " ||| ||| - ", BorderName::Fancy => "╭┬╮├┼┤╰┴╯│:│─−-⋅", BorderName::Blank => "EEEEEEEEEEEEEEEE"}

Border predefined strings, enabled by name, described in enum BorderName

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(border_type : String | BorderName = Config.border_type, styler : BorderStyler = Config.border_styler, alter : Array(Tuple(Int32, String)) | Nil = nil) #

Primary constructor, defined by a string or by a hash of predefined strings of connectors Returns a Border type


[View source]

Class Method Detail

def self.alter(alter : Array(Tuple(Int32, String)) | Nil = nil, styler : BorderStyler | Nil = nil) #

Class method to alter border string and styler

returns a new Border


[View source]

Instance Method Detail

def border_string : String #

[View source]
def styler : String -> String #

[View source]