Class: Marktable::Tables::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/marktable/tables/markdown.rb

Instance Method Summary collapse

Constructor Details

#initialize(table, headers) ⇒ Markdown

Returns a new instance of Markdown.

Parameters:

  • [String] (table)

    The markdown table string.

  • [boolean] (headers)

    Whether the table has headers or not. If nil, it will be inferred from the table content.



11
12
13
14
# File 'lib/marktable/tables/markdown.rb', line 11

def initialize(table, headers)
  @headers_flag = headers
  @markdown_rows = extract_rows(table)
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
# File 'lib/marktable/tables/markdown.rb', line 16

def parse
  if with_headers?
    parse_with_headers
  else
    parse_without_headers
  end
end