Commit 72b0af2c authored by Shinya Maeda's avatar Shinya Maeda

Avoid tap. Use unless&empty.

parent fdcd2f19
...@@ -103,16 +103,14 @@ module Gitlab ...@@ -103,16 +103,14 @@ module Gitlab
while (read_size = calc_read_size(pos, max)) > 0 while (read_size = calc_read_size(pos, max)) > 0
pos += read_size pos += read_size
stream.seek(-pos, IO::SEEK_END) stream.seek(-pos, IO::SEEK_END)
stream.read(read_size).tap do |buf| buf = stream.read(read_size) + debris
buf = buf + debris debris, *lines = buf.each_line.to_a
debris, *lines = buf.each_line.to_a lines.reverse_each do |line|
lines.reverse_each do |line| yield(line)
yield(line)
end
end end
end end
yield(debris) if debris != '' yield(debris) unless debris.empty?
end end
def calc_read_size(pos, max) def calc_read_size(pos, max)
......
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