Sha256: acf54d0041feeb7a94ba1f4c0dc9c35cdf832ad2c49c2b9b42a1b65ea633d448
Contents?: true
Size: 544 Bytes
Versions: 1
Compression:
Stored size: 544 Bytes
Contents
module MagickNumbers class Nip < MagickNumbers::Base def initialize(num) super(num) @mask = [ 6, 5, 7, 2, 3, 4, 5, 6, 7] @modulo = 11 @regexp = /^(PL)?[0-9]*/ # @magick_number = num.to_s.gsub('-', '') end def validate_length @magick_number.size == (international? ? 12 : 10) end def international? /^PL/ =~ @magick_number end def validate_sum_control magick_number.slice!(0..1) if international? mod = checksum % modulo 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/nip.rb |