diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-06 15:26:20 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-06 15:26:20 +0000 |
commit | 0381cec5073031afd6843a096dcec405f93b24aa (patch) | |
tree | ab67fdf5af178d23a04854e45670fd8899c22677 /lib | |
parent | e432a4c4230bcf834ddc0fb61861cd8ae49116f9 (diff) | |
download | bundler-0381cec5073031afd6843a096dcec405f93b24aa.tar.gz |
* lib/net/ftp.rb (initialize): set @sock to a NullSocket instance to
raise FTPConnectionError when not connected. [ruby-dev:40258]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ftp.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 0bf1fb25ca..f393a15bff 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -25,6 +25,7 @@ module Net class FTPTempError < FTPError; end class FTPPermError < FTPError; end class FTPProtoError < FTPError; end + class FTPConnectionError < FTPError; end # :startdoc: # @@ -132,7 +133,7 @@ module Net @passive = false @debug_mode = false @resume = false - @sock = nil + @sock = NullSocket.new @logged_in = false if host connect(host) @@ -966,8 +967,15 @@ module Net return dirname end private :parse257 - end + # :stopdoc: + class NullSocket + def method_missing(mid, *args) + raise FTPConnectionError, "not connected" + end + end + # :startdoc: + end end |