Sha256: 88a1c323e07325a5bcf1876ae887c1a7f7102bc5b091e4c6fa48bfdc49d96f3e

Contents?: true

Size: 563 Bytes

Versions: 5

Compression:

Stored size: 563 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)

      group_numbers = [first_group, second_group, third_group]
      result = format('%.3d-%.2d-%.4d', *group_numbers)

      result
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.16.0 lib/ffaker/ssn.rb
ffaker-2.15.0 lib/ffaker/ssn.rb
ffaker-2.14.0 lib/ffaker/ssn.rb
ffaker-2.13.0 lib/ffaker/ssn.rb
ffaker-2.12.0 lib/ffaker/ssn.rb