Module: EasyTable::ViewExt::Table::Base

Defined in:
lib/easy-table/table/base.rb

Instance Method Summary collapse

Instance Method Details

#render_caption(caption) ⇒ Object



25
26
27
# File 'lib/easy-table/table/base.rb', line 25

def render_caption caption
  indent_tag(1, :caption, caption) if !caption.blank?
end

#render_table(options = {}, &block) ⇒ Object



5
6
7
8
9
# File 'lib/easy-table/table/base.rb', line 5

def render_table options = {}, &block
   :table, options 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, options={}, &block 
  indent_tag 1, :tbody do
    table_body(collection, options, &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, options = {}, &block
  content = []
  collection.each do |obj|
    content << with_output_buffer { yield obj, options }
  end      
  content.join.html_safe
end