diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 15:10:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 15:10:06 +0300 |
commit | b860c6ba2607541e3b5bdf0fc2daaa9ed41a8726 (patch) | |
tree | 73f76e7e69f9902c0e758edd5275cad7f4cb20de /lib/gitlab/ci | |
parent | 6b13a226ddfc49140d58e7e88f8703ae0ed90574 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r-- | lib/gitlab/ci/ansi2json/converter.rb | 7 | ||||
-rw-r--r-- | lib/gitlab/ci/ansi2json/result.rb | 22 |
2 files changed, 24 insertions, 5 deletions
diff --git a/lib/gitlab/ci/ansi2json/converter.rb b/lib/gitlab/ci/ansi2json/converter.rb index cbda3808b86..0373a12ab69 100644 --- a/lib/gitlab/ci/ansi2json/converter.rb +++ b/lib/gitlab/ci/ansi2json/converter.rb @@ -37,16 +37,13 @@ module Gitlab flush_current_line - # TODO: replace OpenStruct with a better type - # https://gitlab.com/gitlab-org/gitlab/issues/34305 - OpenStruct.new( + Gitlab::Ci::Ansi2json::Result.new( lines: @lines, state: @state.encode, append: append, truncated: truncated, offset: start_offset, - size: stream.tell - start_offset, - total: stream.size + stream: stream ) end diff --git a/lib/gitlab/ci/ansi2json/result.rb b/lib/gitlab/ci/ansi2json/result.rb new file mode 100644 index 00000000000..9b573882a52 --- /dev/null +++ b/lib/gitlab/ci/ansi2json/result.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Convertion result object class +module Gitlab + module Ci + module Ansi2json + class Result + attr_reader :lines, :state, :append, :truncated, :offset, :size, :total + + def initialize(lines:, state:, append:, truncated:, offset:, stream:) + @lines = lines + @state = state + @append = append + @truncated = truncated + @offset = offset + @size = stream.tell - offset + @total = stream.size + end + end + end + end +end |