mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
dd738cd887
commit
030a513a49
2 changed files with 11 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue