Class: TTY::Table::Border

Inherits:
Object
  • Object
show all
Includes:
Unicode
Defined in:
lib/tty/table/border.rb,
lib/tty/table/border/null.rb,
lib/tty/table/border/ascii.rb,
lib/tty/table/border/unicode.rb

Overview

Abstract base class that is responsible for building the table border.

Direct Known Subclasses

ASCII, Null, Unicode

Defined Under Namespace

Classes: ASCII, Null, Unicode

Constant Summary collapse

NEWLINE =
"\n"

Instance Method Summary collapse

Methods included from Unicode

#as_unicode, #clean_utf8, #utf8?

Constructor Details

#initializeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instantiate a new object



29
30
31
32
33
34
35
# File 'lib/tty/table/border.rb', line 29

def initialize(*)
  if self.class == Border
    raise NotImplementedError, "#{self} is an abstract class"
  else
    super
  end
end

Instance Method Details

#bottom_lineString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A line spannig all columns marking bottom of a table.

Returns:

  • (String)


69
70
71
# File 'lib/tty/table/border.rb', line 69

def bottom_line
  render :bottom
end

#row_lineString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A line spanning all columns delemeting cells in a row.

Returns:

  • (String)


60
61
62
# File 'lib/tty/table/border.rb', line 60

def row_line
  self['left'] + row.join(self['right']) + self['right']
end

#separatorString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A line spanning all columns delemeting rows in a table.

Returns:

  • (String)


51
52
53
# File 'lib/tty/table/border.rb', line 51

def separator
  render :mid
end

#top_lineString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A line spanning all columns marking top of a table.

Returns:

  • (String)


42
43
44
# File 'lib/tty/table/border.rb', line 42

def top_line
  render :top
end