blob: ad047fbf904e4242fd1d96f1e57f8a9f787b6336 (
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
34
35
36
37
38
|
# frozen_string_literal: true
module Gitlab
module Ci
module Reports
module Security
class FindingKey
def initialize(location_fingerprint:, identifier_fingerprint:)
@location_fingerprint = location_fingerprint
@identifier_fingerprint = identifier_fingerprint
end
def ==(other)
return false unless other.is_a?(self.class)
has_fingerprints? && other.has_fingerprints? &&
location_fingerprint == other.location_fingerprint &&
identifier_fingerprint == other.identifier_fingerprint
end
def hash
location_fingerprint.hash ^ identifier_fingerprint.hash
end
alias_method :eql?, :==
protected
attr_reader :location_fingerprint, :identifier_fingerprint
def has_fingerprints?
location_fingerprint.present? && identifier_fingerprint.present?
end
end
end
end
end
end
|