Skip to content

Commit ca11234

Browse files
Document en-GB Faker::IdNumber locale intricacies
1 parent 41ea916 commit ca11234

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/default/id_number.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,25 @@ Faker::IdNumber.danish_id_number(gender: :female) #=> "050390-9980"
5050
# Generate a valid French Social Security number (INSEE number)
5151
Faker::IdNumber.french_insee_number #=> "22510589696868"
5252
```
53+
54+
## ID Number and Locales
55+
Besides the locale-specific ID Number methods. Faker supports retrieving localised calls to `.valid` and `.invalid`.
56+
Here is an example:
57+
58+
```ruby
59+
Faker::Config.locale = 'fr-FR'
60+
Faker::IdNumber.valid #=> "22510589696868"
61+
```
62+
63+
Locales with specific intricacies are as such:
64+
65+
### en-GB
66+
When provided with British English, unformatted'[National Insurance](https://www.gov.uk/national-insurance/your-national-insurance-number)' numbers are generated.
67+
Note: Faker can only generate a subset of all possible legal/illegal national insurance numbers.
68+
69+
```ruby
70+
Faker::Config.locale = 'en-GB'
71+
Faker::IdNumber.valid #=> "AJ405924A"
72+
Faker::IdNumber.invalid #=> "BG316764W"
73+
```
74+

0 commit comments

Comments
 (0)