Class: Genit::DocumentWriter
- Inherits:
-
Object
- Object
- Genit::DocumentWriter
- Defined in:
- lib/genit/documents/document_writer.rb
Overview
Write an html or xml document.
Instance Method Summary collapse
-
#initialize(working_dir) ⇒ DocumentWriter
constructor
Public: Constructor.
-
#save_as_xhtml(document, filename) ⇒ Object
Save the document as an xhtml file.
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 FileWriter.write document.to_html, get_full_path(filename.force_html_extension) end |