Class: HtmlFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/tablesmith/html_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ HtmlFormatter

Returns a new instance of HtmlFormatter.



6
7
8
9
# File 'lib/tablesmith/html_formatter.rb', line 6

def initialize(table)
  @table = table
  @indent = '    '
end

Instance Attribute Details

#indentObject (readonly)

Returns the value of attribute indent.



4
5
6
# File 'lib/tablesmith/html_formatter.rb', line 4

def indent
  @indent
end

Instance Method Details

#to_htmlObject



11
12
13
14
15
16
17
18
# File 'lib/tablesmith/html_formatter.rb', line 11

def to_html
  @lines = []
  @lines << '<table>'
  append_table_head
  append_table_body
  @lines << '</table>'
  @lines.join("\n") + "\n"
end