class EasyTable::Presenter
Attributes
table[R]
view[R]
Public Class Methods
new(table, view)
click to toggle source
# File lib/easy_table/presenter.rb, line 6 def initialize(table, view) @table, @view = table, view end
Public Instance Methods
render()
click to toggle source
# File lib/easy_table/presenter.rb, line 10 def render content_tag("table", Config.table_html) do trs = "".html_safe trs += render_header trs += render_body end end
render_body()
click to toggle source
# File lib/easy_table/presenter.rb, line 30 def render_body content_tag("tbody") do tbodys = "".html_safe table.items.each do |item| tbodys += content_tag("tr") do tds = "".html_safe table.all_columns.each do |column| tds += content_tag("td", column.value(item, view), column.td_html) end tds end end tbodys end end
render_header()
click to toggle source
# File lib/easy_table/presenter.rb, line 18 def render_header content_tag("thead") do content_tag("tr") do ths = "".html_safe table.all_columns.each do |column| ths += content_tag("th", column.header(table, view), column.th_html) end ths end end end