Class RDoc::SimpleParser
In: parsers/parse_simple.rb
Parent: Object

Parse a non-source file. We basically take the whole thing as one big comment. If the first character in the file is ’#’, we strip leading pound signs.

Methods

Public Class methods

Prepare to parse a plain file

[Source]

    # File parsers/parse_simple.rb, line 14
14:   def initialize(top_level, file_name, body, options, stats)
15:     preprocess = RDoc::Markup::PreProcess.new(file_name, options.rdoc_include)
16: 
17:     preprocess.handle(body) do |directive, param|
18:       warn "Unrecognized directive '#{directive}' in #{file_name}"
19:     end
20: 
21:     @body = body
22:     @options = options
23:     @top_level = top_level
24:   end

Public Instance methods

[Source]

    # File parsers/parse_simple.rb, line 34
34:   def remove_private_comments(comment)
35:     comment.gsub(/^--[^-].*?^\+\+/m, '').sub(/^--.*/m, '')
36:   end

Extract the file contents and attach them to the toplevel as a comment

[Source]

    # File parsers/parse_simple.rb, line 29
29:   def scan
30:     @top_level.comment = remove_private_comments(@body)
31:     @top_level
32:   end

[Validate]