summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-18 01:44:15 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-24 20:10:14 +0900
commit72b0af2c4cefea51c521d3606a0a3307aee41348 (patch)
tree455b20fdff92e590f47b5207dce18a6c3e91502e
parentfdcd2f192dd37ac2a2ea5b73926122009fbbe0aa (diff)
downloadgitlab-ce-72b0af2c4cefea51c521d3606a0a3307aee41348.tar.gz
Avoid tap. Use unless&empty.
-rw-r--r--lib/gitlab/ci/trace/stream.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb
index 39826846be0..d64c43df1d5 100644
--- a/lib/gitlab/ci/trace/stream.rb
+++ b/lib/gitlab/ci/trace/stream.rb
@@ -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
- debris, *lines = buf.each_line.to_a
- lines.reverse_each do |line|
- yield(line)
- end
+ buf = stream.read(read_size) + debris
+ debris, *lines = buf.each_line.to_a
+ lines.reverse_each do |line|
+ yield(line)
end
end
- yield(debris) if debris != ''
+ yield(debris) unless debris.empty?
end
def calc_read_size(pos, max)