diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-12 01:27:52 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-12 01:27:52 +0000 |
commit | 030a513a49f361f09f11a93d11c034ce07921873 (patch) | |
tree | b9075c3c1e1bf1f120e7f370ee250d3f0fa83254 | |
parent | dd738cd887a5a9a6358622aa88704073f0b0bbea (diff) | |
download | ruby-030a513a49f361f09f11a93d11c034ce07921873.tar.gz |
Wrap parse_files' read in a version check for backwards compatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/rdoc/rdoc.rb | 7 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Feb 12 10:25:02 2008 + + * lib/rdoc/rdoc.rb: Wrap parse_files' read in version check for + backwards compatibility. + Tue Feb 12 10:15:14 2008 NARUSE, Yui <naruse@ruby-lang.org> * ruby.c (load_file): enc must effect source encoding. diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 4b9fa88707..6b7de2f3b7 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) |