Module: EasyTable::ViewExt::Table::Base
- Defined in:
- lib/easy-table/table/base.rb
Instance Method Summary collapse
- #render_caption(caption) ⇒ Object
- #render_table(options = {}, &block) ⇒ Object
- #render_tbody(collection, options = {}, &block) ⇒ Object
- #table_body(collection, options = {}, &block) ⇒ Object
Instance Method Details
#render_caption(caption) ⇒ Object
25 26 27 |
# File 'lib/easy-table/table/base.rb', line 25 def indent_tag(1, :caption, ) if !.blank? end |
#render_table(options = {}, &block) ⇒ Object
5 6 7 8 9 |
# File 'lib/easy-table/table/base.rb', line 5 def render_table = {}, &block content_tag :table, do yield.indent(0) end end |
#render_tbody(collection, options = {}, &block) ⇒ Object
11 12 13 14 15 |
# File 'lib/easy-table/table/base.rb', line 11 def render_tbody collection, ={}, &block indent_tag 1, :tbody do table_body(collection, , &block).indent(1) end end |
#table_body(collection, options = {}, &block) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/easy-table/table/base.rb', line 17 def table_body collection, = {}, &block content = [] collection.each do |obj| content << with_output_buffer { yield obj, } end content.join.html_safe end |