class Bank::BBAN
Public Class Methods
new(country_code, code)
click to toggle source
# File lib/bank/bban.rb, line 5 def initialize(country_code, code) @country_code, @code = country_code, code end
Private Class Methods
specifications()
click to toggle source
# File lib/bank/bban.rb, line 36 def self.specifications @@specs ||= Bank.load_specifications(:iban) end
Public Instance Methods
to_s()
click to toggle source
# File lib/bank/bban.rb, line 9 def to_s @code end
valid?()
click to toggle source
# File lib/bank/bban.rb, line 13 def valid? valid_length? && !data.nil? end
valid_length?()
click to toggle source
the bban is the iban minus the first 4 characters (country_code, check_digits)
# File lib/bank/bban.rb, line 18 def valid_length? specification && specification['length'] - 4 == @code.length end
Private Instance Methods
data()
click to toggle source
# File lib/bank/bban.rb, line 28 def data @code.match(/^#{specification['regexp']}$/x) if specification end
specification()
click to toggle source
# File lib/bank/bban.rb, line 32 def specification @specification ||= self.class.specifications[@country_code.downcase] end