Sha256: bcd2a343181a91073cee3567625a04c4f63eaf3fe361866e338b47fc479044ec

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

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

module Coco
  
  # I populate the coverage/ directory with files, if any.
  class HtmlFilesWriter
  
    # @param [Hash] html_files 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

6 entries across 6 versions & 1 rubygems

Version Path
coco-0.9 lib/coco/writer/html_files_writer.rb
coco-0.8 lib/coco/writer/html_files_writer.rb
coco-0.7.1 lib/coco/writer/html_files_writer.rb
coco-0.7 lib/coco/writer/html_files_writer.rb
coco-0.6 lib/coco/writer/html_files_writer.rb
coco-0.5.1 lib/coco/writer/html_files_writer.rb