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)
LICENSE_CATEGORY =
%w(A B C)

Constants included from IdentificationES

FFaker::IdentificationES::GENDERS

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

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 = %w(+ -).sample
  "#{BLOOD_TYPE.sample}#{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 = LICENSE_CATEGORY.sample
  # the categories are A1 A2 B1 B2 B3 C1 C2 C3
  num = category == 'A' ? 1 + rand(2) : 1 + rand(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 = 6 + rand(8)
  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