Class: Taql::Table

Inherits:
Formatter show all
Defined in:
lib/taql/table.rb

Constant Summary collapse

PLUS =
"+".freeze
SPACE =
" ".freeze
VERTICAL_BAR =
"|".freeze

Constants inherited from Formatter

Formatter::DASH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Formatter

#headers, #print

Constructor Details

#initialize(entries, markdown: false) ⇒ Table

Returns a new instance of Table.



11
12
13
14
# File 'lib/taql/table.rb', line 11

def initialize(entries, markdown: false)
  super(entries)
  @markdown = markdown
end

Instance Attribute Details

#markdownObject (readonly)

Returns the value of attribute markdown.



9
10
11
# File 'lib/taql/table.rb', line 9

def markdown
  @markdown
end

Instance Method Details

#bodyObject



20
21
22
# File 'lib/taql/table.rb', line 20

def body
  entries.map(&:values)
end

#table_widthObject



16
17
18
# File 'lib/taql/table.rb', line 16

def table_width
  column_widths.sum + (3 * headers.count) + 1
end