Class: TableCloth::Presenters::Default

Inherits:
TableCloth::Presenter show all
Defined in:
lib/table_cloth/presenters/default.rb

Instance Attribute Summary

Attributes inherited from TableCloth::Presenter

#objects, #table, #view_context

Instance Method Summary collapse

Methods inherited from TableCloth::Presenter

#columns, #initialize, #row_values, #rows

Constructor Details

This class inherits a constructor from TableCloth::Presenter

Instance Method Details

#render_tableObject



4
5
6
7
8
9
# File 'lib/table_cloth/presenters/default.rb', line 4

def render_table
  @render_table ||= ElementFactory::Element.new(:table, tag_options(:table)).tap do |table|
    table << thead
    table << tbody
  end
end

#tbodyObject



17
18
19
20
21
# File 'lib/table_cloth/presenters/default.rb', line 17

def tbody
  @tbody ||= ElementFactory::Element.new(:tbody, tag_options(:tbody)).tap do |tbody|
    objects.each {|object| tbody << row_for_object(object) }
  end
end

#theadObject



11
12
13
14
15
# File 'lib/table_cloth/presenters/default.rb', line 11

def thead
  @thead ||= ElementFactory::Element.new(:thead, tag_options(:thead)).tap do |thead|
    thead << thead_row
  end
end