Class: Faker::Medical::SSN
- Inherits:
-
Base
- Object
- Base
- Faker::Medical::SSN
- Defined in:
- lib/faker/medical/ssn.rb
Constant Summary collapse
- SSN_REGEX =
/(?!(000|666|9))\d{3}(-|\s)?(?!00)\d{2}(-|\s)?(?!0000)\d{4}/
Class Method Summary collapse
-
.ssn ⇒ Object
English social security number has the format xxx-xx-xxxx numerify won’t always generate an SSN that matches correctly repeat until we have a valid SSN.
Class Method Details
.ssn ⇒ Object
English social security number has the format xxx-xx-xxxx numerify won’t always generate an SSN that matches correctly repeat until we have a valid SSN
11 12 13 14 15 16 |
# File 'lib/faker/medical/ssn.rb', line 11 def ssn loop do val = numerify('###-##-####') return val if SSN_REGEX =~ val end end |