summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser/simple.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/parser/simple.rb')
-rw-r--r--lib/rdoc/parser/simple.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb
index 9072667f89..37125ff299 100644
--- a/lib/rdoc/parser/simple.rb
+++ b/lib/rdoc/parser/simple.rb
@@ -24,7 +24,10 @@ class RDoc::Parser::Simple < RDoc::Parser
# Extract the file contents and attach them to the TopLevel as a comment
def scan
- @top_level.comment = remove_private_comments(@content)
+ comment = remove_coding_comment @content
+ comment = remove_private_comments comment
+
+ @top_level.comment = comment
@top_level.parser = self.class
@top_level
end
@@ -33,5 +36,9 @@ class RDoc::Parser::Simple < RDoc::Parser
comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
end
+ def remove_coding_comment text
+ text.sub(/\A# .*coding[=:].*$/, '')
+ end
+
end