Class: CommonNumbers::Regon14

Inherits:
Base
  • Object
show all
Defined in:
lib/common_numbers/regon14.rb

Instance Attribute Summary

Attributes inherited from Base

#length, #magick_array, #magick_number, #mask, #modulo, #regexp

Instance Method Summary collapse

Methods inherited from Base

#checksum, #valid?, #validate, #validate_length, #validate_regexp, #validate_sum_control

Constructor Details

#initialize(num) ⇒ Regon14

Returns a new instance of Regon14.



5
6
7
8
9
10
11
# File 'lib/common_numbers/regon14.rb', line 5

def initialize(num)
  super num
  @mask = [2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8]
  @modulo = 11
  @regexp = /^\d{14}$/
  @length = 14
end