Sha256: c971ec0922faf2feb7a28ad4a66e078a50150b9f2797c51d86b81580040c999c
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module Formatters class Html include Formatters::Base def header columns.map{|col| "<th>#{col.titleize}</th>"}.join("\r\n") end def content Haml::Engine.new(output_template).render( Object.new, { header: header, rows: rows, class_name: file.class_name, complexity: file.complexity, path_to_file: file.path_to_file, date: Time.now.strftime("%Y/%m/%d"), time: Time.now.strftime("%l:%M %P") } ) end def output_template File.read(File.dirname(__FILE__) + "/templates/output.html.haml") end def rows i = 0 file.methods.inject([]) do |a, method| i += 1 a << "<tr class='#{i % 2 == 1 ? 'even' : 'odd'}'>" a << " <td>#{file.class_name}</td>" a << " <td>#{method.prefix}#{method.name}</td>" a << " <td>#{method.complexity}</td>" a << "</tr>" a end.join("\r\n") end def footer end def file_extension ".htm" end end end
Version data entries
4 entries across 4 versions & 1 rubygems