Class: Valvat::Checksum::NL
- Inherits:
-
Base
- Object
- Base
- Valvat::Checksum::NL
show all
- Defined in:
- lib/valvat/checksum/nl.rb
Instance Attribute Summary
Attributes inherited from Base
#vat
Instance Method Summary
collapse
Methods inherited from Base
check_digit_length, #initialize
Instance Method Details
#check_digit ⇒ Object
11
12
13
14
15
|
# File 'lib/valvat/checksum/nl.rb', line 11
def check_digit
sum_figures_by do |fig, i|
fig * (i + 2)
end.modulo(11)
end
|
#str_wo_country ⇒ Object
17
18
19
|
# File 'lib/valvat/checksum/nl.rb', line 17
def str_wo_country
super[0..-4]
end
|
#validate ⇒ Object
6
7
8
9
|
# File 'lib/valvat/checksum/nl.rb', line 6
def validate
vat.to_s.gsub(/[A-Z]/) { |let| (let.ord - 55).to_s }.to_i % 97 == 1 ||
super
end
|