Sha256: befdd6019b4d2607adc3c572dd8c4af3961a2a40c0d07e8bea8c4ee7aba553be

Contents?: true

Size: 315 Bytes

Versions: 12

Compression:

Stored size: 315 Bytes

Contents

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

12 entries across 12 versions & 1 rubygems

Version Path
valvat-1.0.1 lib/valvat/checksum/ro.rb
valvat-1.0.0 lib/valvat/checksum/ro.rb
valvat-0.9.1 lib/valvat/checksum/ro.rb
valvat-0.9.0 lib/valvat/checksum/ro.rb
valvat-0.8.2 lib/valvat/checksum/ro.rb
valvat-0.8.1 lib/valvat/checksum/ro.rb
valvat-0.8.0 lib/valvat/checksum/ro.rb
valvat-0.7.4 lib/valvat/checksum/ro.rb
valvat-0.7.3 lib/valvat/checksum/ro.rb
valvat-0.7.2 lib/valvat/checksum/ro.rb
valvat-0.7.1 lib/valvat/checksum/ro.rb
valvat-0.7.0 lib/valvat/checksum/ro.rb