class Moonrope::DocServer::Generator

Attributes

base[R]

Public Class Methods

new(base, options = {}) click to toggle source
# File lib/moonrope/doc_server.rb, line 32
def initialize(base, options = {})
  @base = base
  @options = options
end

Public Instance Methods

generate_file(output_file, template_file, variables = {}) click to toggle source
# File lib/moonrope/doc_server.rb, line 55
def generate_file(output_file, template_file, variables = {})
  # Generate the page for the requested template with the given variables
  file = DocContext.new(self, :output_file => output_file, :vars => variables)
  file_string = file.render(File.join(template_root_path, "#{template_file}.erb"))
  # Generate the final page within the layout
  DocContext.new(self, :output_file => output_file, :vars => {:page_title => file.vars[:page_title], :active_nav =>file.vars[:active_nav], :body => file_string}).render(File.join(template_root_path, "layout.erb"))
end
host() click to toggle source
# File lib/moonrope/doc_server.rb, line 43
def host
  @options[:host]
end
prefix() click to toggle source
# File lib/moonrope/doc_server.rb, line 47
def prefix
  @options[:prefix]
end
template_root_path() click to toggle source
# File lib/moonrope/doc_server.rb, line 39
def template_root_path
  File.expand_path("../../../templates/basic", __FILE__)
end
version() click to toggle source
# File lib/moonrope/doc_server.rb, line 51
def version
  @options[:version]
end