Class: Valvat::Checksum::RO

Inherits:
Base
  • Object
show all
Defined in:
lib/valvat/checksum/ro.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



6
7
8
9
10
11
# File 'lib/valvat/checksum/ro.rb', line 6

def check_digit
  multipliers = [2, 3, 5, 7, 1, 2, 3, 5, 7]

  sum = sum_figures_by { |digit, index| digit * multipliers[index] }
  sum * 10 % 11 % 10
end

#figures_strObject



13
14
15
# File 'lib/valvat/checksum/ro.rb', line 13

def figures_str
  super.rjust(9, '0')
end