aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 06:16:37 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 06:16:37 +0000
commit5c09cb9c1e38fd262e2af4e6ddda0069384a0ebd (patch)
treed4bfaeb0dc97282635c83460437faa80d4f2a36a /lib/net
parentffe47606ccab45da710ee5f46d28bf7c2ea3305e (diff)
downloadruby-5c09cb9c1e38fd262e2af4e6ddda0069384a0ebd.tar.gz
* lib/net/ftp.rb (getmultiline): refactor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/ftp.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 724f4b85bd..3c3353e9fe 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -298,16 +298,16 @@ module Net
# Receive a section of lines until the response code's match.
def getmultiline # :nodoc:
- line = getline
- buff = line
- if line[3] == ?-
- code = line[0, 3]
+ lines = []
+ lines << getline
+ code = lines.last.slice(/\A([0-9a-zA-Z]{3})-/, 1)
+ if code
+ delimiter = code + " "
begin
- line = getline
- buff << "\n" << line
- end until line[0, 3] == code and line[3] != ?-
+ lines << getline
+ end until lines.last.start_with?(delimiter)
end
- return buff << "\n"
+ return lines.join("\n") + "\n"
end
private :getmultiline