Class: Coco::HtmlIndexWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/coco/writer/html_index_writer.rb

Overview

Public: I write the index.html

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ HtmlIndexWriter

Public: Initialize a new HtmlIndexWriter object.

index - A String HTML document.



11
12
13
14
# File 'lib/coco/writer/html_index_writer.rb', line 11

def initialize(index)
  @index = index
  @dir = HtmlDirectory.new.coverage_dir
end

Instance Method Details

#writeObject

Public: Write the index file in the right place.

Returns nothing.



20
21
22
23
24
# File 'lib/coco/writer/html_index_writer.rb', line 20

def write
  if File.exist?(@dir)
    FileWriter.write File.join(@dir, 'index.html'), @index
  end
end