Class: Faker::Bank
- Inherits:
-
Base
show all
- Defined in:
- lib/faker/default/bank.rb
Constant Summary
Constants inherited
from Base
Faker::Base::Letters, Faker::Base::Numbers, Faker::Base::ULetters
Class Method Summary
collapse
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale
Class Method Details
.account_number(digits = 10) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/faker/default/bank.rb', line 8
def account_number(digits = 10)
output = ''
output += rand.to_s[2..-1] while output.length < digits
output[0...digits]
end
|
.iban(country_code = 'GB') ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/faker/default/bank.rb', line 16
def iban(country_code = 'GB')
begin
pattern = fetch("bank.iban_details.#{country_code.downcase}.bban_pattern")
rescue I18n::MissingTranslationData
raise ArgumentError, "Could not find iban details for #{country_code}"
end
account = Base.regexify(/#{pattern}/)
country_code.upcase + iban_checksum(country_code, account) + account
end
|
.name ⇒ Object
33
34
35
|
# File 'lib/faker/default/bank.rb', line 33
def name
fetch('bank.name')
end
|
.routing_number ⇒ Object
37
38
39
|
# File 'lib/faker/default/bank.rb', line 37
def routing_number
valid_routing_number
end
|
41
42
43
|
# File 'lib/faker/default/bank.rb', line 41
def routing_number_with_format
compile_fraction(valid_routing_number)
end
|
.swift_bic ⇒ Object
45
46
47
|
# File 'lib/faker/default/bank.rb', line 45
def swift_bic
fetch('bank.swift_bic')
end
|