ruby-changes:7489
From: nobu <ko1@a...>
Date: Mon, 1 Sep 2008 11:32:13 +0900 (JST)
Subject: [ruby-changes:7489] Ruby:r19009 (trunk): * lib/fileutils.rb (copy_stream, fu_copy_stream0, copy_file): use
nobu 2008-09-01 11:31:56 +0900 (Mon, 01 Sep 2008) New Revision: 19009 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19009 Log: * lib/fileutils.rb (copy_stream, fu_copy_stream0, copy_file): use IO.copy_stream to get rid of extraneous conversion. Modified files: trunk/ChangeLog trunk/lib/fileutils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19008) +++ ChangeLog (revision 19009) @@ -1,3 +1,8 @@ +Mon Sep 1 11:31:49 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/fileutils.rb (copy_stream, fu_copy_stream0, copy_file): use + IO.copy_stream to get rid of extraneous conversion. + Mon Sep 1 02:55:15 2008 NAKAMURA Usaku <usa@r...> * strftime.c (rb_strftime): calc timezone offset by myself if system Index: lib/fileutils.rb =================================================================== --- lib/fileutils.rb (revision 19008) +++ lib/fileutils.rb (revision 19009) @@ -470,7 +470,7 @@ # +dest+ must respond to #write(str). # def copy_stream(src, dest) - fu_copy_stream0 src, dest, fu_stream_blksize(src, dest) + IO.copy_stream(src, dest) end module_function :copy_stream @@ -1044,11 +1044,8 @@ /mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM end - def fu_copy_stream0(src, dest, blksize) #:nodoc: - # FIXME: readpartial? - while s = src.read(blksize) - dest.write s - end + def fu_copy_stream0(src, dest, blksize = nil) #:nodoc: + IO.copy_stream(src, dest) end def fu_stream_blksize(*streams) @@ -1254,12 +1251,7 @@ end def copy_file(dest) - st = stat() - File.open(path(), 'rb') {|r| - File.open(dest, 'wb', st.mode) {|w| - fu_copy_stream0 r, w, (fu_blksize(st) || fu_default_blksize()) - } - } + IO.copy_stream(path(), dest) end def copy_metadata(path) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/