Class: Gitlab::Ci::Reports::Security::FindingKey

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/reports/security/finding_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(location_fingerprint:, identifier_fingerprint:) ⇒ FindingKey

Returns a new instance of FindingKey.



8
9
10
11
# File 'lib/gitlab/ci/reports/security/finding_key.rb', line 8

def initialize(location_fingerprint:, identifier_fingerprint:)
  @location_fingerprint = location_fingerprint
  @identifier_fingerprint = identifier_fingerprint
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



13
14
15
16
17
18
19
# File 'lib/gitlab/ci/reports/security/finding_key.rb', line 13

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

#hashObject



21
22
23
# File 'lib/gitlab/ci/reports/security/finding_key.rb', line 21

def hash
  location_fingerprint.hash ^ identifier_fingerprint.hash
end