Sha256: fa7e470735f07f8f173a50dc6d1eec062a28f15e404b9b66e458565204a92d22
Contents?: true
Size: 609 Bytes
Versions: 3
Compression:
Stored size: 609 Bytes
Contents
module Rack::App::FrontEnd::Helpers::Table def table_by(array_of_hash) headers = array_of_hash.reduce([]) do |trs, hash| trs.push(*hash.keys) trs.uniq! trs end o = Object.new o.extend(Rack::App::FrontEnd::Helpers::HtmlDsl) table_html = o.__send__ :table_tag do tr_tag do headers.each do |header| td_tag String(header) end end array_of_hash.each do |hash| tr_tag do headers.each do |header| td_tag String(hash[header]) end end end end table_html end end
Version data entries
3 entries across 3 versions & 1 rubygems