Class: RDoc::Markup::ToTableOfContents

### Home Classes Methods

### In Files

- lib/rdoc/markup/to_table_of_contents.rb

### Parent

RDoc::Markup::Formatter

### Methods

- ::to_toc
- #accept_document
- #accept_heading
- #end_accepting
- #start_accepting
- #suppressed?

### Files

- CVE-2013-0256.rdoc
- DEVELOPERS.rdoc
- LICENSE.rdoc
- Manifest.txt
- README.rdoc
- RI.rdoc
- Rakefile
- TODO.rdoc

### Class/Module Index

Quicksearch

- RDoc
- RDoc::Alias
- RDoc::AnonClass
- RDoc::AnyMethod
- RDoc::Attr
- RDoc::ClassModule
- RDoc::CodeObject
- RDoc::Comment
- RDoc::Constant
- RDoc::Context
- RDoc::Context::Section
- RDoc::CrossReference
- RDoc::ERBIO
- RDoc::ERBPartial
- RDoc::Encoding
- RDoc::Error
- RDoc::Extend
- RDoc::Gauntlet
- RDoc::Generator
- RDoc::Generator::Darkfish
- RDoc::Generator::JsonIndex
- RDoc::Generator::Markup
- RDoc::Generator::RI
- RDoc::GhostMethod
- RDoc::Include
- RDoc::Markdown
- RDoc::Markdown::Literals
- RDoc::Markup
- RDoc::Markup::AttrChanger
- RDoc::Markup::AttrSpan
- RDoc::Markup::AttributeManager
- RDoc::Markup::Attributes
- RDoc::Markup::BlankLine
- RDoc::Markup::BlockQuote
- RDoc::Markup::Document
- RDoc::Markup::Formatter
- RDoc::Markup::FormatterTestCase
- RDoc::Markup::HardBreak
- RDoc::Markup::Include
- RDoc::Markup::IndentedParagraph
- RDoc::Markup::List
- RDoc::Markup::ListItem
- RDoc::Markup::Paragraph
- RDoc::Markup::Parser
- RDoc::Markup::Parser::Error
- RDoc::Markup::Parser::ParseError
- RDoc::Markup::PreProcess
- RDoc::Markup::Raw
- RDoc::Markup::Rule
- RDoc::Markup::Special
- RDoc::Markup::TextFormatterTestCase
- RDoc::Markup::ToAnsi
- RDoc::Markup::ToBs
- RDoc::Markup::ToHtml
- RDoc::Markup::ToHtmlCrossref
- RDoc::Markup::ToHtmlSnippet
- RDoc::Markup::ToJoinedParagraph
- RDoc::Markup::ToLabel
- RDoc::Markup::ToMarkdown
- RDoc::Markup::ToRdoc
- RDoc::Markup::ToTableOfContents
- RDoc::Markup::ToTest
- RDoc::Markup::ToTtOnly
- RDoc::Markup::Verbatim
- RDoc::MetaMethod
- RDoc::MethodAttr
- RDoc::NormalClass
- RDoc::NormalModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::Parser::ChangeLog
- RDoc::Parser::Markdown
- RDoc::Parser::RD
- RDoc::Parser::Ruby
- RDoc::Parser::RubyTools
- RDoc::Parser::Simple
- RDoc::Parser::Text
- RDoc::RD
- RDoc::RD::BlockParser
- RDoc::RD::Inline
- RDoc::RD::InlineParser
- RDoc::RDoc
- RDoc::RI
- RDoc::RI::Driver
- RDoc::RI::Driver::Error
- RDoc::RI::Driver::NotFoundError
- RDoc::RI::Error
- RDoc::RI::Paths
- RDoc::Require
- RDoc::RubyLex
- RDoc::RubyLex::Error
- RDoc::RubyToken
- RDoc::RubygemsHook
- RDoc::Servlet
- RDoc::SingleClass
- RDoc::Stats
- RDoc::Stats::Normal
- RDoc::Stats::Quiet
- RDoc::Stats::Verbose
- RDoc::Store
- RDoc::Store::Error
- RDoc::Store::MissingFileError
- RDoc::Task
- RDoc::Task
- RDoc::TestCase
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- Object

No matching classes.

# RDoc::Markup::ToTableOfContents

Extracts just the RDoc::Markup::Heading elements from a RDoc::Markup::Document to help build a table of contents

### Attributes

omit_headings_below[RW]

Omits headings with a level less than the given level.

res[R]

Output accumulator

### Public Class Methods

### Public Instance Methods

accept_document(document) click to toggle source

Adds `document` to the output, using its heading cutoff if present

    # File lib/rdoc/markup/to_table_of_contents.rb, line 35
    def accept_document document
      @omit_headings_below = document.omit_headings_below

      super
    end

accept_heading(heading) click to toggle source

Adds `heading` to the table of contents

    # File lib/rdoc/markup/to_table_of_contents.rb, line 44
    def accept_heading heading
      @res << heading unless suppressed? heading
    end

end_accepting() click to toggle source

Returns the table of contents

    # File lib/rdoc/markup/to_table_of_contents.rb, line 51
    def end_accepting
      @res
    end

start_accepting() click to toggle source

Prepares the visitor for text generation

    # File lib/rdoc/markup/to_table_of_contents.rb, line 58
    def start_accepting
      @omit_headings_below = nil
      @res = []
    end

suppressed?(heading) click to toggle source

Returns true if `heading` is below the display threshold

    # File lib/rdoc/markup/to_table_of_contents.rb, line 66
    def suppressed? heading
      return false unless @omit_headings_below

      heading.level > @omit_headings_below
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.