summaryrefslogtreecommitdiffstats
path: root/lib/rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-12 01:27:52 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-12 01:27:52 +0000
commit041842f515472abcd0d103216d5d38bf6a401db4 (patch)
treeb9075c3c1e1bf1f120e7f370ee250d3f0fa83254 /lib/rdoc
parent080e74778d3636a6804fa3403e4275b208a7eb8b (diff)
downloadruby-041842f515472abcd0d103216d5d38bf6a401db4.tar.gz
ruby-041842f515472abcd0d103216d5d38bf6a401db4.tar.xz
ruby-041842f515472abcd0d103216d5d38bf6a401db4.zip
Wrap parse_files' read in a version check for backwards compatibility.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/rdoc.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 4b9fa8870..6b7de2f3b 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -192,7 +192,12 @@ module RDoc
file_list.each do |fn|
$stderr.printf("\n%*s: ", width, fn) unless options.quiet
- content = File.open(fn, "r:ascii-8bit") {|f| f.read}
+ content = if RUBY_VERSION >= '1.9' then
+ File.open(fn, "r:ascii-8bit") { |f| f.read }
+ else
+ File.read fn
+ end
+
if /coding:\s*(\S+)/ =~ content[/\A(?:.*\n){0,2}/]
if enc = Encoding.find($1)
content.force_encoding(enc)