Avoid tap. Use unless&empty.

This commit is contained in:
Shinya Maeda 2017-05-18 01:44:15 +09:00
parent fdcd2f192d
commit 72b0af2c4c

View file

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