class HTMLWriter

HTMLWriter builds HTML file from a template and copies HTML and theme files to the output directory.

Public Class Methods

new(options) click to toggle source
# File lib/rdoc/generator/html_writer.rb, line 6
def initialize(options)
  @options = options
end

Public Instance Methods

write(data, theme_files, template) click to toggle source
# File lib/rdoc/generator/html_writer.rb, line 10
def write(data, theme_files, template)
  html = template.render(data)
  install_theme(theme_files)
  install_html(html)
end

Private Instance Methods

install_html(html) click to toggle source
# File lib/rdoc/generator/html_writer.rb, line 30
def install_html(html)
  File.open(@options.sf_htmlfile, 'w') do |file|
    file.write(html)
  end
end
install_theme(theme_files) click to toggle source
# File lib/rdoc/generator/html_writer.rb, line 18
def install_theme(theme_files)
  theme_files.each do |file|
    if file[:dst_name]
      if file[:src_path]
        FileUtils.copy_file(file[:src_path], file[:dst_name])
      elsif file[:data]
        File.write(file[:dst_name], file[:data])
      end
    end
  end
end