lib/table_cloth/presenters/default.rb in table_cloth-0.4.2 vs lib/table_cloth/presenters/default.rb in table_cloth-0.4.3
- old
+ new
@@ -3,11 +3,11 @@
class Default < ::TableCloth::Presenter
def render_table
@render_table ||= ElementFactory::Element.new(:table, tag_options(:table)).tap do |table|
table << thead
table << tbody
- end
+ end.to_html
end
def thead
@thead ||= ElementFactory::Element.new(:thead, tag_options(:thead)).tap do |thead|
thead << thead_row
@@ -31,11 +31,13 @@
end
end
end
def row_for_object(object)
- ElementFactory::Element.new(:tr, tag_options(:tr)).tap do |row|
+ tr_options = table.class.tr_options_for(object)
+
+ ElementFactory::Element.new(:tr, tag_options(:tr).merge(tr_options)).tap do |row|
columns.each do |column|
row << column_for_object(column, object)
end
end
end
@@ -59,6 +61,6 @@
ElementFactory::Element.new(:td, tag_options(:td).merge(td_options))
end
end
end
-end
\ No newline at end of file
+end