class Coco::HtmlFilesWriter

Public: I populate the coverage/ directory with files, if any.

Public Class Methods

new(html_files, theme = 'light') click to toggle source

Public: Initialize a new HtmlFilesWriter.

html_files - Hash, key is filename, value is html content. theme - The String name of the theme. Default is light.

# File lib/coco/writer/html_files_writer.rb, line 11
def initialize(html_files, theme = 'light')
  @html_files = html_files
  @html_dir = HtmlDirectory.new(theme)
end

Public Instance Methods

write() click to toggle source

Public: Write HTML files in the right place.

Returns nothing.

# File lib/coco/writer/html_files_writer.rb, line 20
def write
  @html_dir.clean
  return if @html_files.empty?

  @html_dir.setup
  write_each_file
end

Private Instance Methods

write_each_file() click to toggle source
# File lib/coco/writer/html_files_writer.rb, line 30
def write_each_file
  @html_files.each do |filename, html|
    FileWriter.write File.join(
      @html_dir.coverage_dir, Helpers.rb2html(filename)), html
  end
end