Avoid tap. Use unless&empty.
This commit is contained in:
parent
fdcd2f192d
commit
72b0af2c4c
1 changed files with 5 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue