Module: FFaker::IdentificationESCO

Extended by:
IdentificationESCO, ModuleUtils
Includes:
IdentificationES
Included in:
IdentificationESCO
Defined in:
lib/ffaker/identification_es_co.rb

Constant Summary collapse

BLOOD_TYPE =
%w[A B O AB].freeze
LICENSE_CATEGORY =
%w[A B C].freeze

Constants included from IdentificationES

FFaker::IdentificationES::GENDERS

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from IdentificationES

#gender

Instance Method Details

#blood_typeObject

RH


30
31
32
33
# File 'lib/ffaker/identification_es_co.rb', line 30

def blood_type # RH
  sign = fetch_sample(%w[+ -])
  "#{fetch_sample(BLOOD_TYPE)}#{sign}"
end

#driver_license_categoryObject


23
24
25
26
27
28
# File 'lib/ffaker/identification_es_co.rb', line 23

def driver_license_category
  category = fetch_sample(LICENSE_CATEGORY)
  # the categories are A1 A2 B1 B2 B3 C1 C2 C3
  num = category == 'A' ? rand(1..2) : rand(1..3)
  "#{category}#{num}"
end

#drivers_licenseObject Also known as: id


16
17
18
19
# File 'lib/ffaker/identification_es_co.rb', line 16

def drivers_license
  how_many_numbers = rand(6..13)
  FFaker.numerify('#' * how_many_numbers)
end

#expedition_dateObject


35
36
37
38
# File 'lib/ffaker/identification_es_co.rb', line 35

def expedition_date
  today = Date.today
  today - rand(today.year)
end