* 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:
parent
7a063b7416
commit
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>
|
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,
|
* eval.c (ruby_run_node): if an exception occurred in ruby_option,
|
||||||
|
@ -445,12 +445,7 @@ module Net
|
|||||||
loop do
|
loop do
|
||||||
line = conn.gets
|
line = conn.gets
|
||||||
break if line == nil
|
break if line == nil
|
||||||
if line[-2, 2] == CRLF
|
yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
|
||||||
line = line[0 .. -3]
|
|
||||||
elsif line[-1] == ?\n
|
|
||||||
line = line[0 .. -2]
|
|
||||||
end
|
|
||||||
yield(line)
|
|
||||||
end
|
end
|
||||||
conn.close
|
conn.close
|
||||||
voidresp
|
voidresp
|
||||||
@ -570,10 +565,11 @@ module Net
|
|||||||
result = ""
|
result = ""
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
retrlines("RETR " + remotefile) do |line|
|
retrlines("RETR " + remotefile) do |line, newline|
|
||||||
f.puts(line) if localfile
|
l = newline ? line + "\n" : line
|
||||||
yield(line) if block_given?
|
f.print(l) if localfile
|
||||||
result.concat(line + "\n") if result
|
yield(line, newline) if block_given?
|
||||||
|
result.concat(l) if result
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
ensure
|
ensure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user