From d841ebca4ca50039c8970a8e0be602e4dcfca293 Mon Sep 17 00:00:00 2001 From: danielTiringer <53534182+danielTiringer@users.noreply.github.com> Date: Mon, 18 May 2020 16:53:38 +0200 Subject: [PATCH] Add YARD docs to Faker::Bank (#1989) Co-authored-by: Daniel Tiringer --- lib/faker/default/bank.rb | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/faker/default/bank.rb b/lib/faker/default/bank.rb index 613cbc3bc1..e84ee1f262 100644 --- a/lib/faker/default/bank.rb +++ b/lib/faker/default/bank.rb @@ -5,6 +5,17 @@ class Bank < Base flexible :bank class << self + ## + # Produces a bank account number. + # + # @param digits [Integer] Number of digits that the generated account number should have. + # @return [String] + # + # @example + # Faker::Bank.account_number #=> 6738582379 + # Faker::Bank.account_number(digits: 13) #=> 673858237902 + # + # @faker.version 1.9.1 def account_number(legacy_digits = NOT_GIVEN, digits: 10) warn_for_deprecated_arguments do |keywords| keywords << :digits if legacy_digits != NOT_GIVEN @@ -17,6 +28,17 @@ def account_number(legacy_digits = NOT_GIVEN, digits: 10) output[0...digits] end + ## + # Produces a bank iban number. + # + # @param country_code [String] Specifies what country prefix is used to generate the iban code. + # @return [String] + # + # @example + # Faker::Bank.iban #=> "GB76DZJM33188515981979" + # Faker::Bank.iban(country_code: "be") #=> "BE6375388567752043" + # + # @faker.version 1.7.0 def iban(legacy_country_code = NOT_GIVEN, country_code: 'GB') # Each country has its own format for bank accounts # Many of them use letters in certain parts of the account @@ -38,18 +60,54 @@ def iban(legacy_country_code = NOT_GIVEN, country_code: 'GB') country_code.upcase + iban_checksum(country_code, account) + account end + ## + # Produces a bank name. + # + # @return [String] + # + # @example + # Faker::Bank.name #=> "ABN AMRO CORPORATE FINANCE LIMITED" + # + # @faker.version 1.7.0 def name fetch('bank.name') end + ## + # Produces a routing number. + # + # @return [String] + # + # @example + # Faker::Bank.routing_number #=> "729343831" + # + # @faker.version 1.9.1 def routing_number valid_routing_number end + ## + # Produces a valid routing number. + # + # @return [String] + # + # @example + # Faker::Bank.routing_number #=> "729343831" + # + # @faker.version 1.9.1 def routing_number_with_format compile_fraction(valid_routing_number) end + ## + # Produces a swift / bic number. + # + # @return [String] + # + # @example + # Faker::Bank.swift_bic #=> "AAFMGB21" + # + # @faker.version 1.7.0 def swift_bic fetch('bank.swift_bic') end