Sha256: c686d4b5f97de2214377b7aca8584212c2040ced4d07fc2fd9264fdfa0d61e52
Contents?: true
Size: 447 Bytes
Versions: 16
Compression:
Stored size: 447 Bytes
Contents
# frozen_string_literal: true class Valvat module Checksum class CY < Base def check_digit odd_position_digit_values = [1, 0, 5, 7, 9, 13, 15, 17, 19, 21] sum = sum_figures_by do |digit, index| (8 - index).odd? ? odd_position_digit_values[digit] : digit end ('a'..'z').to_a[sum % 26] end def given_check_digit given_check_digit_str.downcase end end end end
Version data entries
16 entries across 16 versions & 1 rubygems