Sha256: f322ecea9049ede5a10ec7d4ce2300d65b7643a05e67c6e630f706e35665775f

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

require 'active_support/core_ext/object/blank'

class BankingData::SwissBank < BankingData::Bank
  include ActiveModel::Model

  attr_accessor :bic

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

  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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
banking_data-0.3.0 lib/banking_data/swiss_bank.rb
banking_data-0.2.0 lib/banking_data/swiss_bank.rb