class Faker::Medical::SSN

Constants

SSN_REGEX

Public Class Methods

ssn() click to toggle source

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

# File lib/faker/medical/ssn.rb, line 11
def ssn
  loop do
    val = numerify('###-##-####')
    return val if SSN_REGEX =~ val
  end
end