Class: Terminal::Table::AsciiBorder

Inherits:
Border
  • Object
show all
Defined in:
lib/terminal-table/style.rb

Direct Known Subclasses

MarkdownBorder

Constant Summary collapse

HORIZONTALS =
%i[x]
VERTICALS =
%i[y]
INTERSECTIONS =
%i[i]

Instance Attribute Summary

Attributes inherited from Border

#bottom, #data, #left, #right, #top

Instance Method Summary collapse

Methods inherited from Border

#[], #[]=, #initialize_dup, #maybeleft, #mayberight, #remove_horizontals, #remove_verticals

Constructor Details

#initializeAsciiBorder

Returns a new instance of AsciiBorder.



44
45
46
47
# File 'lib/terminal-table/style.rb', line 44

def initialize
  super
  @data = { x: "-", y: "|", i:  "+" }
end

Instance Method Details

#horizontal(_type) ⇒ Array

Get horizontal border elements

Returns:

  • (Array)

    a 6 element list of: [i-left, horizontal-bar, i-up/down, i-right, i-down, i-up]



57
58
59
60
# File 'lib/terminal-table/style.rb', line 57

def horizontal(_type)
  x, i = @data[:x], @data[:i]
  [maybeleft(:i), x, i, mayberight(:i), i, i]
end

#verticalArray

Get vertical border elements

Returns:

  • (Array)

    3-element list of [left, center, right]



51
52
53
# File 'lib/terminal-table/style.rb', line 51

def vertical
  [maybeleft(:y), @data[:y], mayberight(:y)] # left, center, right
end