Class: HtmlTables::Renderer
- Inherits:
-
Object
- Object
- HtmlTables::Renderer
- Defined in:
- lib/html_tables/renderer.rb
Instance Method Summary collapse
-
#initialize(helper, table, collection, options = {}) ⇒ Renderer
constructor
A new instance of Renderer.
- #to_html ⇒ Object
Constructor Details
#initialize(helper, table, collection, options = {}) ⇒ Renderer
Returns a new instance of Renderer.
3 4 5 6 7 8 9 |
# File 'lib/html_tables/renderer.rb', line 3 def initialize(helper, table, collection, = {}) @helper = helper @t = table @collection = collection @options = @config = HtmlTables::Configuration.instance end |
Instance Method Details
#to_html ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/html_tables/renderer.rb', line 11 def to_html cls = config.default_table_classes.dup cls << 'table-condensed' if [:condensed] cls << [:class] if [:class] = { class: cls } .merge!([:html]) { |_, v1, v2| [v1, v2].flatten } if [:html] content_tag(:table, ) do content = ''.html_safe content << << colgroup << thead << tfoot << tbody end end |