Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rdoc/generators/html_generator.rb

Files

Class/Module Index [+]

Quicksearch

Generators::HTMLGeneratorInOne

Public Class Methods

new(*args) click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1400
def initialize(*args)
  super
end
            

Public Instance Methods

build_class_list(from, html_file, class_dir) click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1440
def build_class_list(from, html_file, class_dir)
  @classes << HtmlClass.new(from, html_file, class_dir, @options)
  from.each_classmodule do |mod|
    build_class_list(mod, html_file, class_dir)
  end
end
            
build_indices() click to toggle source

Generate:

  • a list of HtmlFile objects for each TopLevel object.

  • a list of HtmlClass objects for each first level class or module in the TopLevel objects

  • a complete list of all hyperlinkable terms (file, class, module, and method names)

 
               # File rdoc/generators/html_generator.rb, line 1429
def build_indices

  @toplevels.each do |toplevel|
    @files << HtmlFile.new(toplevel, @options, FILE_DIR)
  end

  RDoc::TopLevel.all_classes_and_modules.each do |cls|
    build_class_list(cls, @files[0], CLASS_DIR)
  end
end
            
gen_an_index(collection, title) click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1493
def gen_an_index(collection, title)
  res = []
  collection.sort.each do |f|
    if f.document_self
      res << { "href" => f.path, "name" => f.index_name }
    end
  end

  return {
    "entries" => res,
    'list_title' => title,
    'index_url'  => main_url,
  }
end
            
gen_class_index() click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1484
def gen_class_index
  gen_an_index(@classes, 'Classes')
end
            
gen_file_index() click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1480
def gen_file_index
  gen_an_index(@files, 'Files')
end
            
gen_into(list) click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1472
def gen_into(list)
  res = []
  list.each do |item|
    res << item.value_hash
  end
  res
end
            
gen_method_index() click to toggle source
 
               # File rdoc/generators/html_generator.rb, line 1488
def gen_method_index
  gen_an_index(HtmlMethod.all_methods, 'Methods')
end
            
generate(info) click to toggle source

Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.

 
               # File rdoc/generators/html_generator.rb, line 1409
def generate(info)
  @toplevels  = info
  @files      = []
  @classes    = []
  @hyperlinks = {}

  build_indices
  generate_xml
end
            
generate_xml() click to toggle source

Generate all the HTML. For the one-file case, we generate all the information in to one big hash

 
               # File rdoc/generators/html_generator.rb, line 1451
def generate_xml
  values = { 
    'charset' => @options.charset,
    'files'   => gen_into(@files),
    'classes' => gen_into(@classes),
    'title'        => CGI.escapeHTML(@options.title),
  }
  
  # this method is defined in the template file
  write_extra_pages if defined? write_extra_pages

  template = TemplatePage.new(RDoc::Page::ONE_PAGE)

  if @options.op_name
    opfile = File.open(@options.op_name, "w")
  else
    opfile = $stdout
  end
  template.write_html_on(opfile, values)
end