Class: Valideez::Nip
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(val, options = {}) ⇒ Nip
constructor
A new instance of Nip.
- #validate_sum_control ⇒ Object
Methods included from Common
#validate_format, #validate_length
Methods inherited from Base
Constructor Details
#initialize(val, options = {}) ⇒ Nip
Returns a new instance of Nip.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/valideez/nip.rb', line 5 def initialize(val, = {}) super val assign({ :format => /\A\d{10}\Z/, :length => 10, :mask => [6, 5, 7, 2, 3, 4, 5, 6, 7], :modulo => 11, :sum_control => true, }.merge()) @arr = [] end |
Instance Method Details
#validate_sum_control ⇒ Object
19 20 21 22 |
# File 'lib/valideez/nip.rb', line 19 def validate_sum_control mod = checksum % modulo mod === @arr.shift end |