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, filter_function: nil) ⇒ BlobsStitcher
constructor
A new instance of BlobsStitcher.
Constructor Details
#initialize(rpc_response, filter_function: nil) ⇒ BlobsStitcher
Returns a new instance of BlobsStitcher.
8 9 10 11 |
# File 'lib/gitlab/gitaly_client/blobs_stitcher.rb', line 8 def initialize(rpc_response, filter_function: nil) @rpc_response = rpc_response @filter_function = filter_function end |
Instance Method Details
#each {|new_blob(current_blob_data)| ... } ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gitlab/gitaly_client/blobs_stitcher.rb', line 13 def each current_blob_data = nil @rpc_response.each do |msg| if msg.oid.blank? && msg.data.blank? next # rubocop: disable Lint/DuplicateBranch -- No duplication, filter can be supplied elsif removed_by_filter(msg) # rubocop: enable Lint/DuplicateBranch next elsif msg.oid.present? yield new_blob(current_blob_data) if current_blob_data current_blob_data = blob_attributes(msg) 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 |