Class: Gitlab::GitalyClient::BlobsStitcher
- Inherits:
-
Object
- Object
- Gitlab::GitalyClient::BlobsStitcher
- Includes:
- Enumerable
- Defined in:
- lib/gitlab/gitaly_client/blobs_stitcher.rb
Instance Method Summary collapse
- #each {|new_blob(current_blob_data)| ... } ⇒ Object
-
#initialize(rpc_response) ⇒ BlobsStitcher
constructor
A new instance of BlobsStitcher.
Constructor Details
#initialize(rpc_response) ⇒ BlobsStitcher
Returns a new instance of BlobsStitcher.
8 9 10 |
# File 'lib/gitlab/gitaly_client/blobs_stitcher.rb', line 8 def initialize(rpc_response) @rpc_response = rpc_response end |
Instance Method Details
#each {|new_blob(current_blob_data)| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/gitaly_client/blobs_stitcher.rb', line 12 def each current_blob_data = nil @rpc_response.each do |msg| if msg.oid.blank? && msg.data.blank? next elsif msg.oid.present? yield new_blob(current_blob_data) if current_blob_data current_blob_data = msg.to_h.slice(:oid, :path, :size, :revision, :mode) current_blob_data[:data_parts] = [msg.data] else current_blob_data[:data_parts] << msg.data end end yield new_blob(current_blob_data) if current_blob_data end |