Module: FFakerTW::SSN
Instance Method Summary collapse
-
#ssn ⇒ Object
The Social Security number is a nine-digit number in the format “AAA-GG-SSSS”.
Methods included from ModuleUtils
const_missing, k, luhn_check, underscore, unique
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#ssn ⇒ Object
The Social Security number is a nine-digit number in the format “AAA-GG-SSSS”. More info here:
13 14 15 16 17 18 19 20 |
# File 'lib/ffakerTW/ssn.rb', line 13 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 |