Class: Taql::Table
Constant Summary collapse
- PLUS =
"+".freeze
- SPACE =
" ".freeze
- VERTICAL_BAR =
"|".freeze
Constants inherited from Formatter
Instance Attribute Summary collapse
-
#markdown ⇒ Object
readonly
Returns the value of attribute markdown.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(entries, markdown: false) ⇒ Table
constructor
A new instance of Table.
- #table_width ⇒ Object
Methods inherited from Formatter
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
#markdown ⇒ Object (readonly)
Returns the value of attribute markdown.
9 10 11 |
# File 'lib/taql/table.rb', line 9 def markdown @markdown end |
Instance Method Details
#body ⇒ Object
20 21 22 |
# File 'lib/taql/table.rb', line 20 def body entries.map(&:values) end |
#table_width ⇒ Object
16 17 18 |
# File 'lib/taql/table.rb', line 16 def table_width column_widths.sum + (3 * headers.count) + 1 end |