class BankValidator::Bic

Attributes

value[RW]

Public Class Methods

new(bic) click to toggle source
# File lib/bank_validator/bic.rb, line 5
def initialize(bic)
  @value = bic
end
valid_format?(bic) click to toggle source
# File lib/bank_validator/bic.rb, line 13
def self.valid_format?(bic)
  bic =~ /[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}/ ? true : false
end

Public Instance Methods

valid?() click to toggle source
# File lib/bank_validator/bic.rb, line 9
def valid?
  BankValidator::Bic.valid_format?(value) && (value.length == 8 || value.length == 11)
end