lib/fukuzatsu/formatters/html_index.rb in fukuzatsu-1.0.6 vs lib/fukuzatsu/formatters/html_index.rb in fukuzatsu-2.1.1
- old
+ new
@@ -1,47 +1,54 @@
-module Formatters
+module Fukuzatsu
- class HtmlIndex
+ module Formatters
- include Formatters::Base
+ class HtmlIndex
- attr_reader :file_summary, :output_directory
+ include Formatters::Base
- def initialize(file_summary, output_directory=nil)
- @file_summary = file_summary
- @output_directory = output_directory
- end
+ attr_reader :summaries
- def content
- Haml::Engine.new(output_template).render(
- Object.new, {
- file_summary: file_summary,
- date: Time.now.strftime("%Y/%m/%d"),
- time: Time.now.strftime("%l:%M %P")
- }
- )
- end
+ def initialize(summaries)
+ @summaries = summaries
+ end
- def export
- begin
- File.open(path_to_results, 'w') {|outfile| outfile.write(content)}
- rescue Exception => e
- puts "Unable to write output: #{e} #{e.backtrace}"
+ 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
- end
- def filename
- "index.htm"
- end
+ 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
- def output_path
- FileUtils.mkpath(self.output_directory)
- self.output_directory
- end
+ def filename
+ "index.htm"
+ end
- def output_template
- File.read(File.dirname(__FILE__) + "/templates/index.html.haml")
+ def file_extension
+ ".htm"
+ end
+
+ def output_path
+ FileUtils.mkpath(self.output_directory)
+ self.output_directory
+ end
+
+ def output_template
+ File.read(File.dirname(__FILE__) + "/templates/index.html.haml")
+ end
+
end
end
-end
\ No newline at end of file
+end