Sha256: 83f04f1c3d9e76fe7db51d74666fa8007cdaf0cb2b70e86efe3068d7a6a6c753

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module FFaker
  module SSN
    extend ModuleUtils
    extend self

    # The Social Security number is a nine-digit number in the format
    # "AAA-GG-SSSS". More info here:
    #
    # http://en.wikipedia.org/wiki/Social_Security_number
    #
    def ssn
      first_group  = fetch_sample([*1..665, *667..899])
      second_group = rand(1..99)
      third_group  = rand(1..9999)

      format(
        '%<first_group>.3d-%<second_group>.2d-%<third_group>.4d',
        first_group: first_group, second_group: second_group, third_group: third_group
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffaker-2.23.0 lib/ffaker/ssn.rb