Class: HtmlTable::TableBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/html_table/table_builder.rb

Defined Under Namespace

Classes: ColumnFooters, ColumnHeaders

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, options = {}, &block) ⇒ TableBuilder

Returns a new instance of TableBuilder.



6
7
8
9
10
11
# File 'lib/html_table/table_builder.rb', line 6

def initialize(collection, options={}, &block)
  init_instance_vars(options)
  collection.each do |object|
    @rows << HtmlTable::TableRowBuilder.new(object, &block)
  end
end

Instance Attribute Details

#rowsObject

Returns the value of attribute rows.



4
5
6
# File 'lib/html_table/table_builder.rb', line 4

def rows
  @rows
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
# File 'lib/html_table/table_builder.rb', line 13

def to_s
  "<table#{attributes}>
    #{thead}
    #{tbody}
    #{tfoot}
  </table>"
end