[前][次][番号順一覧][スレッド一覧]

ruby-changes:3946

From: ko1@a...
Date: Tue, 12 Feb 2008 10:29:17 +0900 (JST)
Subject: [ruby-changes:3946] drbrain - Ruby:r15436 (trunk): Wrap parse_files' read in a version check for backwards compatibility.

drbrain	2008-02-12 10:27:52 +0900 (Tue, 12 Feb 2008)

  New Revision: 15436

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/rdoc.rb

  Log:
    Wrap parse_files' read in a version check for backwards compatibility.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15436&r2=15435&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/rdoc.rb?r1=15436&r2=15435&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15435)
+++ ChangeLog	(revision 15436)
@@ -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@r...>
 
 	* ruby.c (load_file): enc must effect source encoding.
Index: lib/rdoc/rdoc.rb
===================================================================
--- lib/rdoc/rdoc.rb	(revision 15435)
+++ lib/rdoc/rdoc.rb	(revision 15436)
@@ -192,7 +192,12 @@
       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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]