Sha256: bc508dc81093bbed4d0f2a85aba283d8927e332226c50b18ebcb3b3a148275fd

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 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 html file.
    #
    # document - A Nokogiri::HTML or Nokogiri::XML document
    # filename - The String name of the future saved document
    def save_as_html document, filename
      FileWriter.write document.to_html, get_full_path(filename.force_html_extension)
    end
    
    private
    
    def get_full_path filename
      File.join(@working_dir, 'www', filename)
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genit-0.4 lib/genit/document_writer.rb
genit-0.3 lib/genit/document_writer.rb