ruby-changes:40011
From: shugo <ko1@a...>
Date: Fri, 9 Oct 2015 16:28:19 +0900 (JST)
Subject: [ruby-changes:40011] shugo:r52092 (trunk): * lib/net/ftp.rb: use frozen_string_literal: true.
shugo 2015-10-09 16:28:10 +0900 (Fri, 09 Oct 2015) New Revision: 52092 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52092 Log: * lib/net/ftp.rb: use frozen_string_literal: true. * test/net/ftp/test_buffered_socket.rb: ditto. * test/net/ftp/test_ftp.rb: ditto. * test/net/ftp/test_mlsx_entry.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/net/ftp.rb trunk/test/net/ftp/test_buffered_socket.rb trunk/test/net/ftp/test_ftp.rb trunk/test/net/ftp/test_mlsx_entry.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52091) +++ ChangeLog (revision 52092) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Oct 9 15:52:28 2015 Shugo Maeda <shugo@r...> + + * lib/net/ftp.rb: use frozen_string_literal: true. + + * test/net/ftp/test_buffered_socket.rb: ditto. + + * test/net/ftp/test_ftp.rb: ditto. + + * test/net/ftp/test_mlsx_entry.rb: ditto. + Fri Oct 9 14:12:35 2015 Shota Fukumori (sora_h) <her@s...> * ext/openssl/lib/openssl/ssl.rb: Revert r52082 because it was Index: lib/net/ftp.rb =================================================================== --- lib/net/ftp.rb (revision 52091) +++ lib/net/ftp.rb (revision 52092) @@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L1 # +# -*- frozen_string_literal: true -*- +# # = net/ftp.rb - FTP Client Library # # Written by Shugo Maeda <shugo@r...>. @@ -610,7 +612,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L612 f = open(localfile, "w") end elsif !block_given? - result = "" + result = String.new end begin f.binmode if localfile @@ -637,7 +639,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L639 if localfile f = open(localfile, "w") elsif !block_given? - result = "" + result = String.new end begin retrlines("RETR #{remotefile}") do |line, newline| @@ -1287,11 +1289,11 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L1289 def read(len = nil) if len - s = super(len, "", true) + s = super(len, String.new, true) return s.empty? ? nil : s else result = "" - while s = super(DEFAULT_BLOCKSIZE, "", true) + while s = super(DEFAULT_BLOCKSIZE, String.new, true) break if s.empty? result << s end Index: test/net/ftp/test_mlsx_entry.rb =================================================================== --- test/net/ftp/test_mlsx_entry.rb (revision 52091) +++ test/net/ftp/test_mlsx_entry.rb (revision 52092) @@ -1,3 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_mlsx_entry.rb#L1 +# +# -*- frozen_string_literal: true -*- + require "net/ftp" require "test/unit" require "ostruct" Index: test/net/ftp/test_ftp.rb =================================================================== --- test/net/ftp/test_ftp.rb (revision 52091) +++ test/net/ftp/test_ftp.rb (revision 52092) @@ -1,3 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1 +# +# -*- frozen_string_literal: true -*- + require "net/ftp" require "test/unit" require "ostruct" @@ -545,7 +548,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L548 assert_match(/\AUSER /, commands.shift) assert_match(/\APASS /, commands.shift) assert_equal("TYPE I\r\n", commands.shift) - buf = "" + buf = String.new assert_raise(Net::ReadTimeout) do ftp.retrbinary("RETR foo", 1024) do |s| buf << s @@ -602,7 +605,7 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L605 assert_match(/\AUSER /, commands.shift) assert_match(/\APASS /, commands.shift) assert_equal("TYPE I\r\n", commands.shift) - buf = "" + buf = String.new ftp.retrbinary("RETR foo", 1024) do |s| buf << s end @@ -785,7 +788,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L788 assert_match(/\AUSER /, commands.shift) assert_match(/\APASS /, commands.shift) assert_equal("TYPE I\r\n", commands.shift) - buf = "" + buf = String.new ftp.retrlines("RETR foo") do |line| buf << line + "\r\n" end Index: test/net/ftp/test_buffered_socket.rb =================================================================== --- test/net/ftp/test_buffered_socket.rb (revision 52091) +++ test/net/ftp/test_buffered_socket.rb (revision 52092) @@ -1,3 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_buffered_socket.rb#L1 +# +# -*- frozen_string_literal: true -*- + require "net/ftp" require "test/unit" require "ostruct" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/