Sha256: 9371f8eb18ca8ce3aec78eb0723f25c368e3672283493850d6281afc321f77d7

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

# -*- encoding: utf-8 -*-

module Coco
  
  # I populate the coverage/ directory with files, if any.
  class HtmlFilesWriter
  
    # html_files - Hash, key is filename, value is html content.
    def initialize html_files
      @html_files = html_files
      @html_dir = HtmlDirectory.new
    end
    
    def write
      @html_dir.clean
      if @html_files.size > 0
        @html_dir.setup
        write_each_file
      end
    end
    
    private
    
    def write_each_file
      @html_files.each do |filename, html|
        FileWriter.write File.join(
          @html_dir.coverage_dir, Helpers.rb2html(filename)), html
      end
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coco-0.10.0 lib/coco/writer/html_files_writer.rb