Sha256: f781063154b46e577c2d956fc1a33d1fb82682215912e01a352c6ab1a4131aa4
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
# -*- encoding: utf-8 -*- require 'fileutils' module Genit # Write an html or xml document. class DocumentWriter # Public: Constructor. # # working_dir - the string working directory, where live the project. def initialize working_dir @working_dir = working_dir end # Save the document as an xhtml file. # # document - A Nokogiri::HTML or Nokogiri::XML document # filename - The String name of the future saved document 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 def remove_remaining_tags tags = @document.css 'genit' tags.each {|tag| tag.remove} end def get_full_path filename File.join(@working_dir, filename) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
genit-2.1 | lib/genit/documents/document_writer.rb |
genit-2.0 | lib/genit/documents/document_writer.rb |