class Ibanizator::Iban::ExtendedData::DE

Attributes

iban[R]

Public Class Methods

new(iban) click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 9
def initialize(iban)
  raise Invalid, "can't compute extended data on invalid iban" unless iban.valid?
  @iban = iban
end

Public Instance Methods

account_number() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 19
def account_number
  iban.to_s[12..-1].gsub(/\A0+/,"")
end
bank_code() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 14
def bank_code
  iban.to_s[4..11]
end
bank_name() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 28
def bank_name
  bank.name
end
bic() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 24
def bic
  bank.bic
end
to_h()
Alias for: to_hash
to_hash() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 32
def to_hash
  {
    bank_code: bank_code,
    account_number: account_number,
    bic: bic,
    bank_name: bank_name,
  }
end
Also aliased as: to_h

Private Instance Methods

bank() click to toggle source
# File lib/ibanizator/iban/extended_data/de.rb, line 44
def bank
  Ibanizator.bank_db.bank_by_bank_code(bank_code)
end