Class: Gitlab::Diff::FileCollection::WikiPage

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/diff/file_collection/wiki_page.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, #diffs, #pagination_data, #raw_diff_files, #unfold_diff_files, #write_cache

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(page, diff_options:) ⇒ WikiPage

Returns a new instance of WikiPage.


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

def initialize(page, diff_options:)
  commit = page.wiki.commit(page.version.commit)
  diff_options = diff_options.merge(
    expanded: true,
    paths: [page.path]
  )

  super(commit,
    # TODO: Uncouple diffing from projects
    # https://gitlab.com/gitlab-org/gitlab/-/issues/217752
    project: page.wiki,
    diff_options: diff_options,
    diff_refs: commit.diff_refs)
end