Sha256: 991fef0483c97f038466316ce4935468b3cd061abe59d185f128d1c922373e11

Contents?: true

Size: 251 Bytes

Versions: 14

Compression:

Stored size: 251 Bytes

Contents

# frozen_string_literal: true

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

14 entries across 14 versions & 1 rubygems

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