Class: Registration::Fingerprint

Inherits:
Object
  • Object
show all
Defined in:
src/lib/registration/fingerprint.rb

Constant Summary collapse

SHA1 =
"SHA1".freeze
SHA256 =
"SHA256".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sum, value) ⇒ Fingerprint


9
10
11
12
# File 'src/lib/registration/fingerprint.rb', line 9

def initialize(sum, value)
  @sum = sum
  @value = value
end

Instance Attribute Details

#sumObject (readonly)

Returns the value of attribute sum


4
5
6
# File 'src/lib/registration/fingerprint.rb', line 4

def sum
  @sum
end

#valueObject (readonly)

Returns the value of attribute value


4
5
6
# File 'src/lib/registration/fingerprint.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object


14
15
16
17
18
19
20
# File 'src/lib/registration/fingerprint.rb', line 14

def ==(other)
  return false if other.nil?

  # case insensitive compare of the fingerprint value
  # (ignore optional colon separators)
  sum.casecmp(other.sum) == 0 && value.tr(":", "").casecmp(other.value.tr(":", "")) == 0
end