Class: Ibanizator::Iban::ExtendedData::DE

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
lib/ibanizator/iban/extended_data/de.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iban) ⇒ DE

Returns a new instance of DE.

Raises:



9
10
11
12
# 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

Instance Attribute Details

#ibanObject (readonly)

Returns the value of attribute iban.



5
6
7
# File 'lib/ibanizator/iban/extended_data/de.rb', line 5

def iban
  @iban
end

Instance Method Details

#account_numberObject



19
20
21
# File 'lib/ibanizator/iban/extended_data/de.rb', line 19

def 
  iban.to_s[12..-1].gsub(/\A0+/,"")
end

#bank_codeObject



14
15
16
# File 'lib/ibanizator/iban/extended_data/de.rb', line 14

def bank_code
  iban.to_s[4..11]
end

#bank_nameObject



28
29
30
# File 'lib/ibanizator/iban/extended_data/de.rb', line 28

def bank_name
  bank.name
end

#bicObject



24
25
26
# File 'lib/ibanizator/iban/extended_data/de.rb', line 24

def bic
  bank.bic
end

#to_hashObject Also known as: to_h



32
33
34
35
36
37
38
39
# File 'lib/ibanizator/iban/extended_data/de.rb', line 32

def to_hash
  {
    bank_code: bank_code,
    account_number: ,
    bic: bic,
    bank_name: bank_name,
  }
end