Class: Genit::DocumentWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/genit/documents/document_writer.rb

Overview

Write an html or xml document.

Instance Method Summary collapse

Constructor Details

#initialize(working_dir) ⇒ DocumentWriter

Public: Constructor.

working_dir - the string working directory, where live the project.



13
14
15
# File 'lib/genit/documents/document_writer.rb', line 13

def initialize working_dir
  @working_dir = working_dir
end

Instance Method Details

#save_as_xhtml(document, filename) ⇒ Object

Save the document as an xhtml file.

document - A Nokogiri::HTML or Nokogiri::XML document filename - The String name of the future saved document



21
22
23
24
25
# File 'lib/genit/documents/document_writer.rb', line 21

def save_as_xhtml document, filename
  @document = document
  remove_remaining_tags
  FileWriter.write document.to_html, get_full_path(filename.force_html_extension)
end