Sha256: 5634c3bdbb3a8b9fabb22999d26fad78bf3c09b27f3454f35aa115798bdde079
Contents?: true
Size: 617 Bytes
Versions: 2
Compression:
Stored size: 617 Bytes
Contents
require_relative '../errors/invalid_bank_code_error' require_relative '../errors/bank_not_found_error' module SwiftBic class BankDb BANKS = {}.tap do |banks| File.open(File.expand_path('../../../db/blz.txt', __FILE__), 'r').each_line do |line| code, _, _, _, _, name, _, bic = line.unpack 'A8A1A58A5A35A27A5A11' next if bic.empty? name.force_encoding('iso-8859-1').encode!('utf-8') banks[code] = { name: name, bic: bic } end end def validate_bank_code(bank_code) return true if bank_code.length == 8 raise InvalidBankCodeError end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dkd-ibanizator-0.10.0 | lib/swift_bic/bank_db.rb |
dkd-ibanizator-0.9.0 | lib/swift_bic/bank_db.rb |