Class: Valideez::Iban

Inherits:
Base
  • Object
show all
Includes:
Common
Defined in:
lib/valideez/iban.rb

Instance Attribute Summary

Attributes inherited from Base

#val, #validable

Instance Method Summary collapse

Methods included from Common

#validate_format, #validate_length

Methods inherited from Base

#valid?

Constructor Details

#initialize(val, options = {}) ⇒ Iban

Returns a new instance of Iban.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/valideez/iban.rb', line 5

def initialize(val, options = {})
  super val

  assign({ 
    format: /\A[A-Z][A-Z]\d{26}\Z/, 
    length: 28,
    modulo: 97,
    sum_control: true,
  }.merge(options))

  @arr = []
end

Instance Method Details

#validate_sum_controlObject



18
19
20
21
# File 'lib/valideez/iban.rb', line 18

def validate_sum_control
  mod = checksum % modulo
  mod === 1
end