Sha256: 264d03f81cd13a2b06e01733e3a60f753fba138ee57dae61bec5098c9e51b48c

Contents?: true

Size: 346 Bytes

Versions: 14

Compression:

Stored size: 346 Bytes

Contents

# frozen_string_literal: true

class Valvat
  module Checksum
    class RO < Base
      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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
valvat-1.4.4 lib/valvat/checksum/ro.rb
valvat-1.4.3 lib/valvat/checksum/ro.rb
valvat-1.4.2 lib/valvat/checksum/ro.rb
valvat-1.4.1 lib/valvat/checksum/ro.rb
valvat-1.4.0 lib/valvat/checksum/ro.rb
valvat-1.3.0 lib/valvat/checksum/ro.rb
valvat-1.2.1 lib/valvat/checksum/ro.rb
valvat-1.2.0 lib/valvat/checksum/ro.rb
valvat-1.1.5 lib/valvat/checksum/ro.rb
valvat-1.1.4 lib/valvat/checksum/ro.rb
valvat-1.1.3 lib/valvat/checksum/ro.rb
valvat-1.1.2 lib/valvat/checksum/ro.rb
valvat-1.1.1 lib/valvat/checksum/ro.rb
valvat-1.1.0 lib/valvat/checksum/ro.rb