Class: Gitlab::Diff::FileCollection::Compare

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/diff/file_collection/compare.rb

Instance Attribute Summary

Attributes inherited from Base

#diff_options, #diff_refs, #diffable, #fallback_diff_refs, #project

Instance Method Summary collapse

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?, #pagination_data, #raw_diff_files, #unfold_diff_files, #write_cache

Constructor Details

#initialize(compare, project:, diff_options:, diff_refs: nil) ⇒ Compare

Returns a new instance of Compare.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/diff/file_collection/compare.rb', line 9

def initialize(compare, project:, diff_options:, diff_refs: nil)
  @pagination = Gitlab::PaginationDelegate.new(
    page: diff_options&.delete(:page),
    per_page: diff_options&.delete(:per_page),
    count: diff_options&.delete(:count)
  )

  super(compare,
    project: project,
    diff_options: diff_options,
    diff_refs: diff_refs)
end

Instance Method Details

#cache_keyObject



26
27
28
# File 'lib/gitlab/diff/file_collection/compare.rb', line 26

def cache_key
  ['compare', @diffable.head.id, @diffable.base.id]
end

#unfold_diff_lines(positions) ⇒ Object



22
23
24
# File 'lib/gitlab/diff/file_collection/compare.rb', line 22

def unfold_diff_lines(positions)
  # no-op
end