summaryrefslogtreecommitdiff
path: root/lib/ftplib.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-09 09:58:00 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-09 09:58:00 +0000
commit2b255619648eec600db99260f293167f1b0faed7 (patch)
tree3a5d00ecbc12716bcce09022afcb553258e323cb /lib/ftplib.rb
parente32da15f48189cfba02a9be2e6572161d91b3122 (diff)
1.1b9_09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ftplib.rb')
-rw-r--r--lib/ftplib.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ftplib.rb b/lib/ftplib.rb
index b58a01cdaa..4069089cc3 100644
--- a/lib/ftplib.rb
+++ b/lib/ftplib.rb
@@ -389,19 +389,20 @@ class FTP
return files
end
- def list(*args)
+ def list(*args, &block)
cmd = "LIST"
- if iterator?
- callback = Proc.new
- elsif args[-1].is_a?(Proc)
- callback = args.pop
- else
- callback = nil
- end
args.each do |arg|
cmd = cmd + " " + arg
end
- retrlines(cmd, callback)
+ if block
+ retrlines(cmd, &block)
+ else
+ lines = []
+ retrlines(cmd) do |line|
+ lines << line
+ end
+ return lines
+ end
end
alias ls list
alias dir list
@@ -441,6 +442,7 @@ class FTP
end
def size(filename)
+ voidcmd("TYPE I")
resp = sendcmd("SIZE " + filename)
if resp[0, 3] == "213"
return resp[3 .. -1].strip.to_i