Class: Valvat::Checksum::DK
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
check_digit_length, #initialize, #validate
Constructor Details
This class inherits a constructor from Valvat::Checksum::Base
Instance Method Details
#check_digit ⇒ Object
8 9 10 11 12 13 |
# File 'lib/valvat/checksum/dk.rb', line 8 def check_digit weight = [2, 7, 6, 5, 4, 3, 2, 1] figures.map do |fig| fig * weight.shift end.inject(:+).modulo(11) end |
#given_check_digit ⇒ Object
15 16 17 |
# File 'lib/valvat/checksum/dk.rb', line 15 def given_check_digit 0 end |