Sha256: e6f8c73c4463808e0a1ce1b94d94de8093efd1cee460928db541e7069e3bd053
Contents?: true
Size: 800 Bytes
Versions: 4
Compression:
Stored size: 800 Bytes
Contents
module Faker class Bank < Base flexible :bank class << self def name fetch('bank.name') end def swift_bic fetch('bank.swift_bic') end def iban(bank_country_code="GB") details = iban_details.find { |country| country["bank_country_code"] == bank_country_code.upcase } raise ArgumentError, "Could not find iban details for #{bank_country_code}" unless details bcc = details["bank_country_code"] + 2.times.map{ rand(10) }.join ilc = (0...details["iban_letter_code"].to_i).map{ (65 + rand(26)).chr }.join ib = details["iban_digits"].to_i.times.map{ rand(10) }.join bcc + ilc + ib end private def iban_details fetch_all('bank.iban_details') end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
faker-1.8.4 | lib/faker/bank.rb |
faker-1.8.3 | lib/faker/bank.rb |
faker-1.8.2 | lib/faker/bank.rb |
faker-1.8.0 | lib/faker/bank.rb |