Sha256: ebbe24aa103b796c16f276d09901f1fd4df7a22913d7b0ed7988960b4a0c5cf3

Contents?: true

Size: 542 Bytes

Versions: 9

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  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

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 lib/ffakerTW/ssn.rb
ffakerTW-1.7.0 lib/ffakerTW/ssn.rb
ffakerTW-1.6.0 lib/ffakerTW/ssn.rb
ffakerTW-1.5.0 lib/ffakerTW/ssn.rb
ffakerTW-1.4.0 lib/ffakerTW/ssn.rb
ffakerTW-1.3.0 lib/ffakerTW/ssn.rb
ffakerTW-1.2.0 lib/ffakerTW/ssn.rb
ffakerTW-1.1.0 lib/ffakerTW/ssn.rb
ffakerTW-0.1.0 lib/ffakerTW/ssn.rb