Class: RDoc::Parser::Simple
- Inherits:
-
Parser
- Object
- Parser
- RDoc::Parser::Simple
- Includes:
- Text
- Defined in:
- lib/rdoc/parser/simple.rb
Overview
Parse a non-source file. We basically take the whole thing as one big comment.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(top_level, content, options, stats) ⇒ Simple
constructor
Prepare to parse a plain file.
-
#remove_coding_comment(text) ⇒ Object
Removes the encoding magic comment from
text. -
#scan ⇒ Object
Extract the file contents and attach them to the TopLevel as a comment.
Constructor Details
#initialize(top_level, content, options, stats) ⇒ Simple
Prepare to parse a plain file
19 20 21 22 23 24 25 26 |
# File 'lib/rdoc/parser/simple.rb', line 19 def initialize(top_level, content, , stats) super preprocess = Markup::PreProcess.new @file_name, @options.rdoc_include content = ::RDoc::Text.(@content) @content, = preprocess.run_pre_processes(content, @top_level, 1, :simple) end |
Instance Attribute Details
#content ⇒ Object (readonly)
:nodoc:
14 15 16 |
# File 'lib/rdoc/parser/simple.rb', line 14 def content @content end |
Instance Method Details
#remove_coding_comment(text) ⇒ Object
Removes the encoding magic comment from text
43 44 45 |
# File 'lib/rdoc/parser/simple.rb', line 43 def remove_coding_comment(text) text.sub(/\A# .*coding[=:].*$/, '') end |