HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Ruby27-x64/share/doc/ruby/html/RDoc/Generator.html
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>module RDoc::Generator - RDoc Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
</script>

<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/rdoc.css" rel="stylesheet">




<body id="top" role="document" class="module">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#module-RDoc::Generator-label-Registering+a+Generator">Registering a Generator</a>
    <li><a href="#module-RDoc::Generator-label-Adding+Options+to+rdoc">Adding Options to <code>rdoc</code></a>
    <li><a href="#module-RDoc::Generator-label-Generator+Instantiation">Generator Instantiation</a>
  </ul>
</div>


  <div id="class-metadata">
    
    
    
    
    
  </div>
</nav>

<main role="main" aria-labelledby="module-RDoc::Generator">
  <h1 id="module-RDoc::Generator" class="module">
    module RDoc::Generator
  </h1>

  <section class="description">
    
<p><a href="RDoc.html"><code>RDoc</code></a> uses generators to turn parsed source code in the form of an <a href="CodeObject.html"><code>RDoc::CodeObject</code></a> tree into some form of output.  <a href="RDoc.html"><code>RDoc</code></a> comes with the HTML generator RDoc::Generator::Darkfish and an ri data generator RDoc::Generator::RI.</p>

<h2 id="module-RDoc::Generator-label-Registering+a+Generator">Registering a <a href="Generator.html"><code>Generator</code></a><span><a href="#module-RDoc::Generator-label-Registering+a+Generator">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>Generators are registered by calling <a href="RDoc.html#method-c-add_generator"><code>RDoc::RDoc.add_generator</code></a> with the class of the generator:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">My</span><span class="ruby-operator">::</span><span class="ruby-constant">Awesome</span><span class="ruby-operator">::</span><span class="ruby-constant">Generator</span>
  <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">RDoc</span>.<span class="ruby-identifier">add_generator</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span>
</pre>

<h2 id="module-RDoc::Generator-label-Adding+Options+to+rdoc">Adding <a href="Options.html"><code>Options</code></a> to <code>rdoc</code><span><a href="#module-RDoc::Generator-label-Adding+Options+to+rdoc">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>Before option processing in <code>rdoc</code>, <a href="Options.html"><code>RDoc::Options</code></a> will call ::setup_options on the generator class with an <a href="Options.html"><code>RDoc::Options</code></a> instance.  The generator can use <a href="Options.html#attribute-i-option_parser"><code>RDoc::Options#option_parser</code></a> to add command-line options to the <code>rdoc</code> tool.  See <a href="Options.html#class-RDoc::Options-label-Custom+Options">Custom Options at <code>RDoc::Options</code></a> for an example and see <a href="../OptionParser.html"><code>OptionParser</code></a> for details on how to add options.</p>

<p>You can extend the <a href="Options.html"><code>RDoc::Options</code></a> instance with additional accessors for your generator.</p>

<h2 id="module-RDoc::Generator-label-Generator+Instantiation"><a href="Generator.html"><code>Generator</code></a> Instantiation<span><a href="#module-RDoc::Generator-label-Generator+Instantiation">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>After parsing, <a href="RDoc.html"><code>RDoc::RDoc</code></a> will instantiate a generator by calling initialize with an <a href="Store.html"><code>RDoc::Store</code></a> instance and an <a href="Options.html"><code>RDoc::Options</code></a> instance.</p>

<p>The <a href="Store.html"><code>RDoc::Store</code></a> instance holds documentation for parsed source code.  In <a href="RDoc.html"><code>RDoc</code></a> 3 and earlier the <a href="TopLevel.html"><code>RDoc::TopLevel</code></a> class held this data.  When upgrading a generator from <a href="RDoc.html"><code>RDoc</code></a> 3 and earlier you should only need to replace <a href="TopLevel.html"><code>RDoc::TopLevel</code></a> with the store instance.</p>

<p><a href="RDoc.html"><code>RDoc</code></a> will then call generate on the generator instance.  You can use the various methods on <a href="Store.html"><code>RDoc::Store</code></a> and in the <a href="CodeObject.html"><code>RDoc::CodeObject</code></a> tree to create your desired output format.</p>

  </section>

  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    
  </section>

</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>