Class: Valvat::Checksum::GR
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
6 7 8 9 10 11 |
# File 'lib/valvat/checksum/gr.rb', line 6 def check_digit chk = sum_figures_by do |fig, i| fig * (2**(i + 1)) end.modulo(11) chk > 9 ? 0 : chk end |