class
v1_9_3_125 -
Show latest stable
-
0 notes
- Superclass:
Object
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (-9)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
A parser is a class that subclasses RDoc::Parser and implements
#initialize top_level, file_name, body, options, stats
and
#scan
The initialize method takes a file name to be used, the body of the file, and an RDoc::Options object. The scan method is then called to return an appropriately parsed TopLevel code object.
RDoc::Parser::for is a factory that creates the correct parser for a given filename extension. Parsers have to register themselves RDoc::Parser using parse_files_matching as when they are loaded:
require "rdoc/parser" class RDoc::Parser::Xyz < RDoc::Parser parse_files_matching /\.xyz$/ # <<<< def initialize top_level, file_name, body, options, stats ... end def scan ... end end
If a plain text file is detected, RDoc also looks for a shebang line in case the file is a shell script.