Sha256: ad98e160f36d39dbb77a862dcdf3f2df259ab3937d615cdfc7ff76f94e629b3b

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

class Ibanizator
  class Iban
    module ExtendedData
      class DE
        attr_reader :iban
        include Equalizer.new(:iban)
        include Adamantium

        def initialize(iban)
          raise Invalid, "can't compute extended data on invalid iban" unless iban.valid?
          @iban = iban
        end

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

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

        def bic
          Ibanizator.bank_db.bank_by_bank_code(bank_code).bic
        end
        memoize :bic
      end
    end # ExtendedData
  end # Iban
end # Ibanizator

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ibanizator-0.3.5 lib/ibanizator/iban/extended_data/de.rb
ibanizator-0.3.4 lib/ibanizator/iban/extended_data/de.rb
ibanizator-0.3.3 lib/ibanizator/iban/extended_data/de.rb
ibanizator-0.3.2 lib/ibanizator/iban/extended_data/de.rb
ibanizator-0.3.1 lib/ibanizator/iban/extended_data/de.rb
ibanizator-0.3.0 lib/ibanizator/iban/extended_data/de.rb