Commit c7145ba6 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Executable] Use partition to split the lines

parent cc1611da
...@@ -99,16 +99,12 @@ module Pod ...@@ -99,16 +99,12 @@ module Pod
buf = '' buf = ''
begin begin
loop do loop do
s = input.readpartial(4096) buf << input.readpartial(4096)
buf << s loop do
lines = buf.split("\n") string, separator, buf = buf.partition(/[\n\r]/)
if buf[-1] == "\n" break if separator.empty?
buf = '' output << (string << separator)
else
buf = lines[-1]
lines.pop
end end
lines.each { |l| output << (l << "\n") }
end end
rescue EOFError rescue EOFError
output << (buf << "\n") unless buf.size == 0 output << (buf << "\n") unless buf.size == 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment