Sha256: 0d2ddc40a27bbb7ba9d20661ae781ba6ae2c75ed298a4613d2716ff19dab2aa1

Contents?: true

Size: 237 Bytes

Versions: 16

Compression:

Stored size: 237 Bytes

Contents

class Valvat
  module Checksum
    class PL < Base
      def check_digit
        weight = [6, 5, 7, 2, 3, 4, 5, 6, 7]
        figures.map do |fig|
          fig * weight.shift
        end.inject(:+).modulo(11)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
valvat-1.0.1 lib/valvat/checksum/pl.rb
valvat-1.0.0 lib/valvat/checksum/pl.rb
valvat-0.9.1 lib/valvat/checksum/pl.rb
valvat-0.9.0 lib/valvat/checksum/pl.rb
valvat-0.8.2 lib/valvat/checksum/pl.rb
valvat-0.8.1 lib/valvat/checksum/pl.rb
valvat-0.8.0 lib/valvat/checksum/pl.rb
valvat-0.7.4 lib/valvat/checksum/pl.rb
valvat-0.7.3 lib/valvat/checksum/pl.rb
valvat-0.7.2 lib/valvat/checksum/pl.rb
valvat-0.7.1 lib/valvat/checksum/pl.rb
valvat-0.7.0 lib/valvat/checksum/pl.rb
valvat-0.6.11 lib/valvat/checksum/pl.rb
valvat-0.6.10 lib/valvat/checksum/pl.rb
valvat-0.6.9 lib/valvat/checksum/pl.rb
valvat-0.6.8 lib/valvat/checksum/pl.rb