Sha256: d94dfd6e100cc92e3dc140ce9bfc7983f4b461d4ab26832cac5c629ed6dcdaef

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

module MagickNumbers
  class Pesel < MagickNumbers::Base

    def initialize(num)
      super num
      @mask = [ 1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
      @modulo = 10
      @regexp = /\d{11}/
      @length = 11
    end

    def validate_sum_control
      mod = checksum % modulo
      mod = 10 - mod
      mod = 0 if mod == 10
      mod === magick_array.shift
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
magick_numbers-0.1.3 lib/magick_numbers/pesel.rb