class Fukuzatsu::Formatters::HtmlIndex

Attributes

summaries[R]

Public Class Methods

new(summaries, base_output_path) click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 11
def initialize(summaries, base_output_path)
  @summaries = summaries
  @base_output_path = base_output_path
end

Public Instance Methods

content() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 16
def content
  Haml::Engine.new(output_template).render(
    Object.new, {
      summaries: summaries,
      date: Time.now.strftime("%Y/%m/%d"),
      time: Time.now.strftime("%l:%M %P")
    }
  )
end
export() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 26
def export
  begin
    File.open(path_to_results, 'w') {|outfile| outfile.write(content)}
  rescue Exception => e
    puts "Unable to write output: #{e} #{e.backtrace}"
  end
end
file_extension() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 38
def file_extension
  ".htm"
end
filename() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 34
def filename
  "index.htm"
end
output_path() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 42
def output_path
  FileUtils.mkpath(self.output_directory)
  self.output_directory
end
output_template() click to toggle source
# File lib/fukuzatsu/formatters/html_index.rb, line 47
def output_template
  File.read(File.dirname(__FILE__) + "/templates/index.html.haml")
end