class Genit::DocumentWriter
Write an html or xml document.
Public Class Methods
new(working_dir)
click to toggle source
Public: Constructor.
working_dir - the string working directory, where live the project.
# File lib/genit/documents/document_writer.rb, line 12 def initialize working_dir @working_dir = working_dir end
Public Instance Methods
save_as_xhtml(document, filename)
click to toggle source
Save the document as an xhtml file.
document - A Nokogiri::HTML or Nokogiri::XML
document filename - The String
name of the future saved document
# File lib/genit/documents/document_writer.rb, line 20 def save_as_xhtml document, filename @document = document remove_remaining_tags FileWriter.write document.to_html, get_full_path(filename.force_html_extension) end
Private Instance Methods
get_full_path(filename)
click to toggle source
# File lib/genit/documents/document_writer.rb, line 33 def get_full_path filename File.join(@working_dir, filename) end