Class: RDoc::Parser::Simple
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Parser
|
|
|
Instance Chain:
self,
Text,
Parser
|
|
| Inherits: |
Parser
|
| Defined in: | lib/rdoc/parser/simple.rb |
Overview
Parse a non-source file. We basically take the whole thing as one big comment.
Class Method Summary
-
.new(top_level, content, options, stats) ⇒ Simple
constructor
Prepare to parse a plain file.
Instance Attribute Summary
- #content readonly Internal use only
Instance Method Summary
-
#remove_coding_comment(text)
Removes the encoding magic comment from
text -
#scan
Extract the file contents and attach them to the
::RDoc::TopLevelas a comment.
Constructor Details
.new(top_level, content, options, stats) ⇒ Simple
Prepare to parse a plain file
Instance Attribute Details
#content (readonly)
This method is for internal use only.
[ GitHub ]
# File 'lib/rdoc/parser/simple.rb', line 14
attr_reader :content # :nodoc:
Instance Method Details
#remove_coding_comment(text)
Removes the encoding magic comment from text
# File 'lib/rdoc/parser/simple.rb', line 43
def remove_coding_comment(text) text.sub(/\A# .*coding[=:].*$/, '') end
#scan
Extract the file contents and attach them to the ::RDoc::TopLevel as a comment
# File 'lib/rdoc/parser/simple.rb', line 31
def scan content = remove_coding_comment @content comment = Comment.new content, @top_level @top_level.comment = comment @top_level end