Sha256: c3baff8e2608c365da8e7f23fb90103dad4107149949c78d46195465c9ba6a1f

Contents?: true

Size: 242 Bytes

Versions: 8

Compression:

Stored size: 242 Bytes

Contents

require 'valvat/checksum'

class Valvat
  module Checksum
    class GR < Base
      def check_digit
        chk = sum_figures_by do |fig, i|
          fig*(2**(i+1))
        end.modulo(11)
        chk > 9 ? 0 : chk
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
valvat-0.6.7 lib/valvat/checksum/gr.rb
valvat-0.6.6 lib/valvat/checksum/gr.rb
valvat-0.6.5 lib/valvat/checksum/gr.rb
valvat-0.6.4 lib/valvat/checksum/gr.rb
valvat-0.6.3 lib/valvat/checksum/gr.rb
valvat-0.6.2 lib/valvat/checksum/gr.rb
valvat-0.6.1 lib/valvat/checksum/gr.rb
valvat-0.6.0 lib/valvat/checksum/gr.rb