зеркало из https://github.com/github/ruby.git
* lib/net/ftp.rb (retrlines): added a new block parameter.
* lib/net/ftp.rb (gettextfile): preserve missing end-of-line at end of files. [ruby-core:24590] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7a063b7416
Коммит
9994d05b7e
|
@ -1,3 +1,10 @@
|
|||
Mon Oct 12 22:48:25 2009 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* lib/net/ftp.rb (retrlines): added a new block parameter.
|
||||
|
||||
* lib/net/ftp.rb (gettextfile): preserve missing end-of-line at end
|
||||
of files. [ruby-core:24590]
|
||||
|
||||
Mon Oct 12 19:48:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (ruby_run_node): if an exception occurred in ruby_option,
|
||||
|
|
|
@ -445,12 +445,7 @@ module Net
|
|||
loop do
|
||||
line = conn.gets
|
||||
break if line == nil
|
||||
if line[-2, 2] == CRLF
|
||||
line = line[0 .. -3]
|
||||
elsif line[-1] == ?\n
|
||||
line = line[0 .. -2]
|
||||
end
|
||||
yield(line)
|
||||
yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
|
||||
end
|
||||
conn.close
|
||||
voidresp
|
||||
|
@ -570,10 +565,11 @@ module Net
|
|||
result = ""
|
||||
end
|
||||
begin
|
||||
retrlines("RETR " + remotefile) do |line|
|
||||
f.puts(line) if localfile
|
||||
yield(line) if block_given?
|
||||
result.concat(line + "\n") if result
|
||||
retrlines("RETR " + remotefile) do |line, newline|
|
||||
l = newline ? line + "\n" : line
|
||||
f.print(l) if localfile
|
||||
yield(line, newline) if block_given?
|
||||
result.concat(l) if result
|
||||
end
|
||||
return result
|
||||
ensure
|
||||
|
|
Загрузка…
Ссылка в новой задаче