class Valvat::Checksum::FI
Public Instance Methods
check_digit()
click to toggle source
# File lib/valvat/checksum/fi.rb, line 6 def check_digit weight = [7, 9, 10, 5, 8, 4, 2] chk = 11 - figures.map do |fig| fig * weight.shift end.inject(:+).modulo(11) chk == 11 ? 0 : chk end