ruby-changes:14746
From: shugo <ko1@a...>
Date: Sun, 7 Feb 2010 00:29:50 +0900 (JST)
Subject: [ruby-changes:14746] Ruby:r26605 (trunk): * lib/net/ftp.rb (initialize): set @sock to a NullSocket instance to
shugo 2010-02-07 00:26:20 +0900 (Sun, 07 Feb 2010) New Revision: 26605 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26605 Log: * lib/net/ftp.rb (initialize): set @sock to a NullSocket instance to raise FTPConnectionError when not connected. [ruby-dev:40258] Modified files: trunk/ChangeLog trunk/lib/net/ftp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 26604) +++ ChangeLog (revision 26605) @@ -1,3 +1,8 @@ +Sat Feb 6 23:37:11 2010 Shugo Maeda <shugo@r...> + + * lib/net/ftp.rb (initialize): set @sock to a NullSocket instance to + raise FTPConnectionError when not connected. [ruby-dev:40258] + Sat Feb 6 23:25:57 2010 Shugo Maeda <shugo@r...> * ext/curses/view2.rb: replaced with Hugh Sasse's version. Index: lib/net/ftp.rb =================================================================== --- lib/net/ftp.rb (revision 26604) +++ lib/net/ftp.rb (revision 26605) @@ -25,6 +25,7 @@ class FTPTempError < FTPError; end class FTPPermError < FTPError; end class FTPProtoError < FTPError; end + class FTPConnectionError < FTPError; end # :startdoc: # @@ -132,7 +133,7 @@ @passive = false @debug_mode = false @resume = false - @sock = nil + @sock = NullSocket.new @logged_in = false if host connect(host) @@ -966,8 +967,15 @@ return dirname end private :parse257 + + # :stopdoc: + class NullSocket + def method_missing(mid, *args) + raise FTPConnectionError, "not connected" + end + end + # :startdoc: end - end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/