class RDoc::Parser::Simple

Parse a non-source file. We basically take the whole thing as one big comment.

Public Class Methods

Prepare to parse a plain file

Calls superclass method RDoc::Parser::new
# File lib/rdoc/parser/simple.rb, line 17
def initialize(top_level, content, options, stats)
  super

  preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include

  content = RDoc::Text.expand_tabs(@content)
  @content, = preprocess.run_pre_processes(content, @top_level, 1, :simple)
end

Public Instance Methods

Removes the encoding magic comment from text

# File lib/rdoc/parser/simple.rb, line 41
def remove_coding_comment(text)
  text.sub(/\A# .*coding[=:].*$/, '')
end

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

# File lib/rdoc/parser/simple.rb, line 29
def scan
  content = remove_coding_comment @content

  comment = RDoc::Comment.new content, @top_level

  @top_level.comment = comment
  @top_level
end