Class: Valvat::Checksum::DK

Inherits:
Base
  • Object
show all
Defined in:
lib/valvat/checksum/dk.rb

Instance Attribute Summary

Attributes inherited from Base

#vat

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_digitObject



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_digitObject



15
16
17
# File 'lib/valvat/checksum/dk.rb', line 15

def given_check_digit
  0
end