Class: Gitlab::Ci::Build::Artifacts::Adapters::RawStream

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb

Constant Summary collapse

InvalidStreamError =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ RawStream

Returns a new instance of RawStream.

Raises:


13
14
15
16
17
# File 'lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb', line 13

def initialize(stream)
  raise InvalidStreamError, "Stream is required" unless stream

  @stream = stream
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream


9
10
11
# File 'lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb', line 9

def stream
  @stream
end

Instance Method Details

#each_blob {|stream.read, 'raw'| ... } ⇒ Object

Yields:


19
20
21
22
23
# File 'lib/gitlab/ci/build/artifacts/adapters/raw_stream.rb', line 19

def each_blob
  stream.seek(0)

  yield(stream.read, 'raw') unless stream.eof?
end