Class: BankingData::SwissBank

Inherits:
Bank
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/banking_data/swiss_bank.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Bank

only, where

Instance Attribute Details

#bicObject

Returns the value of attribute bic.



6
7
8
# File 'lib/banking_data/swiss_bank.rb', line 6

def bic
  @bic
end

Class Method Details

.allObject



8
9
10
# File 'lib/banking_data/swiss_bank.rb', line 8

def self.all
  @@all ||= get_all
end

.fileObject



24
25
26
# File 'lib/banking_data/swiss_bank.rb', line 24

def self.file
  File.dirname(__FILE__) + '/../../data/bcbankenstamm.txt'
end

.get_allObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/banking_data/swiss_bank.rb', line 12

def self.get_all
  banks = []
  File.read(file, encoding: 'iso-8859-1').lines.each do |line|
    kennzeichen = line[7..10]
    if kennzeichen == '0000'
      bic = line[284..294]
      banks << new(bic: bic)
    end
  end
  banks
end