Type:
Class

A parser is simple a class that subclasses RDoc::Parser and implements scan to fill in an RDoc::TopLevel with parsed data.

The initialize method takes an RDoc::TopLevel to fill with parsed content, the name of the file to be parsed, the content of the file, an RDoc::Options object and an RDoc::Stats object to inform the user of parsed items. The scan method is then called to parse the file and must return the RDoc::TopLevel object. By calling super these items will be set for you.

In order to be used by RDoc the parser needs to register the file extensions it can parse. Use ::parse_files_matching to register extensions.

require 'rdoc'

class RDoc::Parser::Xyz < RDoc::Parser
  parse_files_matching /\.xyz$/

  def initialize top_level, file_name, content, options, stats
    super

    # extra initialization if needed
  end

  def scan
    # parse file and fill in @top_level
  end
end
use_markup

use_markup(content) Class Public methods If there is a markup: parser_name

2015-05-03 21:15:28
process_directive

process_directive(code_object, directive, value) Class Public methods Processes

2015-05-03 21:11:01
zip?

zip?(file) Class Public methods Checks if file is a zip file in

2015-05-03 21:21:49
check_modeline

check_modeline(file_name) Class Public methods Returns the file type from the

2015-05-03 20:55:04
for

for(top_level, file_name, content, options, stats) Class Public methods Finds

2015-05-03 21:01:29
binary?

binary?(file) Class Public methods Determines if the file is a âbinaryâ file

2015-05-03 20:44:25
alias_extension

alias_extension(old_ext, new_ext) Class Public methods Alias an extension to

2015-05-03 20:39:38
can_parse_by_name

can_parse_by_name(file_name) Class Public methods Returns a parser that can

2015-05-03 20:54:01
new

new(top_level, file_name, content, options, stats) Class Public methods Creates

2015-05-03 21:02:46
can_parse

can_parse(file_name) Class Public methods Return a parser that can handle a

2015-05-03 20:46:44