Sha256: ff06c5ede56b7f6ff02c6e02ef2b46d5b6bb9860010862f6dddff5cb313bb17c

Contents?: true

Size: 540 Bytes

Versions: 6

Compression:

Stored size: 540 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]
      format('%.3d-%.2d-%.4d', *group_numbers)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-2.22.0 lib/ffaker/ssn.rb
ffaker-2.21.0 lib/ffaker/ssn.rb
ffaker-2.20.0 lib/ffaker/ssn.rb
ffaker-2.19.0 lib/ffaker/ssn.rb
ffaker-2.18.0 lib/ffaker/ssn.rb
ffaker-2.17.0 lib/ffaker/ssn.rb