Welcome to mirror list, hosted at ThFree Co, Russian Federation.

file_formatter.rb « formatters « diff « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 37b9ad85ef8f771b30114c33965e5f91448eeecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

module Gitlab
  module Diff
    module Formatters
      class FileFormatter < BaseFormatter
        def initialize(attrs)
          @ignore_whitespace_change = false

          super(attrs)
        end

        def key
          @key ||= super.push(new_path, old_path)
        end

        def position_type
          "file"
        end

        def complete?
          [new_path, old_path].all?(&:present?)
        end

        def ==(other)
          other.is_a?(self.class) &&
            old_path == other.old_path &&
            new_path == other.new_path
        end
      end
    end
  end
end