Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YARD docs to Faker::NHS #2055

Merged
merged 1 commit into from Jun 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/faker/default/nhs.rb
Expand Up @@ -3,6 +3,15 @@
module Faker
class NationalHealthService < Base
class << self
##
# Produces a random British NHS number.
#
# @return [String]
#
# @example
# Faker::NationalHealthService.british_number #=> "403 958 5577"
#
# @faker.version 1.9.2
def british_number
base_number = rand(400_000_001...499_999_999)
# If the check digit is equivalent to 10, the number is invalid.
Expand All @@ -15,6 +24,16 @@ def british_number
.join('')
end

##
# Produces a random British NHS number's check digit.
#
# @param number [Integer] Specifies the NHS number the check digit belongs to.
# @return [Integer]
#
# @example
# Faker::NationalHealthService.check_digit(number: 400_012_114) #=> 6
#
# @faker.version 1.9.2
def check_digit(legacy_number = NOT_GIVEN, number: 0)
warn_for_deprecated_arguments do |keywords|
keywords << :number if legacy_number != NOT_GIVEN
Expand Down