Class: SimpleDataPresentation::SimpleTable::Body
- Defined in:
- lib/simple_data_presentation/simple_table/body.rb
Instance Method Summary collapse
-
#initialize(context, collection, options = {}, &content_block) ⇒ Body
constructor
A new instance of Body.
- #render! ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(context, collection, options = {}, &content_block) ⇒ Body
Returns a new instance of Body.
2 3 4 5 6 7 |
# File 'lib/simple_data_presentation/simple_table/body.rb', line 2 def initialize(context, collection, = {}, &content_block) @context = context @collection = collection @options = @content_block = content_block end |
Instance Method Details
#render! ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/simple_data_presentation/simple_table/body.rb', line 9 def render! = @options.delete :tbody_html = @options.merge :html => @options.delete(:row_html) rows_content = @collection.map do |resource| tr = SimpleDataPresentation::SimpleTable::Row.new @context, resource, , &@content_block tr.render! end @context.raw @context.content_tag :tbody, rows_content.join.html_safe, end |