Module: FFaker::IdentificationFI
- Extended by:
- IdentificationFI, ModuleUtils
- Included in:
- IdentificationFI
- Defined in:
- lib/ffaker/identification_fi.rb
Constant Summary collapse
- CHECK_DIGITS =
'0123456789ABCDEFHJKLMNPRSTUVWXY'
- POSSIBLY_REAL_FEMALE_INDIVIDUAL_NUMBERS =
Number ranges in real use
(2..898).step(2).to_a.freeze
- POSSIBLY_REAL_MALE_INDIVIDUAL_NUMBERS =
(3..899).step(2).to_a.freeze
- FAKE_FEMALE_INDIVIDUAL_NUMBERS =
Number ranges not in real use
(900..998).step(2).to_a.freeze
- FAKE_MALE_INDIVIDUAL_NUMBERS =
(901..999).step(2).to_a.freeze
Instance Method Summary collapse
Methods included from ModuleUtils
const_missing, k, luhn_check, underscore, unique
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Instance Method Details
#identity_number(gender: FFaker::Gender.binary, birthday: FFaker::Date.birthday, fake: true) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/ffaker/identification_fi.rb', line 16 def identity_number(gender: FFaker::Gender.binary, birthday: FFaker::Date.birthday, fake: true) day = fetch_formatted_day(birthday) month = fetch_formatted_month(birthday) year = fetch_formatted_year(birthday) separator = fetch_separator(birthday) individual_number = fetch_individual_number(gender, fake) check_digit = calculate_check_digit(birthday, individual_number) "#{day}#{month}#{year}#{separator}#{individual_number}#{check_digit}" end |