Class: Gitlab::Diff::FileCollection::MergeRequestDiffBatch
- Inherits:
-
MergeRequestDiffBase
- Object
- Base
- MergeRequestDiffBase
- Gitlab::Diff::FileCollection::MergeRequestDiffBatch
- Includes:
- PaginatedDiffs
- Defined in:
- lib/gitlab/diff/file_collection/merge_request_diff_batch.rb
Overview
Builds a paginated diff file collection and collects pagination metadata.
It doesn’t handle caching yet as we’re not prepared to write/read separate file keys (gitlab.com/gitlab-org/gitlab/issues/30550).
Constant Summary collapse
- DEFAULT_BATCH_PAGE =
1
- DEFAULT_BATCH_SIZE =
30
Instance Attribute Summary collapse
-
#pagination_data ⇒ Object
readonly
Returns the value of attribute pagination_data.
Attributes inherited from Base
#diff_options, #diff_refs, #diffable, #fallback_diff_refs, #project
Instance Method Summary collapse
-
#initialize(merge_request_diff, batch_page, batch_size, diff_options:) ⇒ MergeRequestDiffBatch
constructor
A new instance of MergeRequestDiffBatch.
Methods included from PaginatedDiffs
Methods included from Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods inherited from MergeRequestDiffBase
#clear_cache, #diff_files, #raw_diff_files, #write_cache
Methods inherited from Base
#clear_cache, default_options, #diff_file_paths, #diff_file_with_new_path, #diff_file_with_old_path, #diff_files, #diff_paths, #diffs, #overflow?, #raw_diff_files, #unfold_diff_files, #write_cache
Constructor Details
#initialize(merge_request_diff, batch_page, batch_size, diff_options:) ⇒ MergeRequestDiffBatch
Returns a new instance of MergeRequestDiffBatch.
20 21 22 23 24 25 26 27 28 |
# File 'lib/gitlab/diff/file_collection/merge_request_diff_batch.rb', line 20 def initialize(merge_request_diff, batch_page, batch_size, diff_options:) super(merge_request_diff, diff_options: ) @paginated_collection = load_paginated_collection(batch_page, batch_size, ) @pagination_data = { total_pages: @paginated_collection.blank? ? nil : relation.size } end |
Instance Attribute Details
#pagination_data ⇒ Object (readonly)
Returns the value of attribute pagination_data.
18 19 20 |
# File 'lib/gitlab/diff/file_collection/merge_request_diff_batch.rb', line 18 def pagination_data @pagination_data end |