class RDoc::Markup::ToTableOfContents

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

Attributes

res[R]

Output accumulator

Public Class Methods

to_toc() click to toggle source

Singleton for ToC generation

# File lib/rdoc/markup/to_table_of_contents.rb, line 12
def self.to_toc
  @to_toc ||= new
end

Public Instance Methods

accept_heading(heading) click to toggle source

Adds heading to the table of contents

# File lib/rdoc/markup/to_table_of_contents.rb, line 24
def accept_heading heading
  @res << heading
end
end_accepting() click to toggle source

Returns the table of contents

# File lib/rdoc/markup/to_table_of_contents.rb, line 31
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 38
def start_accepting
  @res = []
end