Sha256: c57fa5e90d4cf8176406f584548bbd105afd1b055301be5f65362b6343d6bfe4

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require 'active_support/core_ext/object/blank'

class BankingData::GermanBank < BankingData::Bank
  extend ActiveModel::Naming
  include ActiveModel::Conversion
  include ActiveModel::AttributeMethods

  LOCALE = :de

  attr_accessor :bic, :blz

  class << self

    delegate :where, :only, to: :query

    def all
      @@all ||= get_all
    end

    private

      def get_all
        banks = []
        File.open(file).each_line do |line|
          blz = line[0..7]
          bic = line[139..149]
          banks << new(bic: bic, blz: blz)
        end
        banks
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
banking_data-0.4.0 lib/banking_data/german_bank.rb