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.



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

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