Module: Faker::IdentificationESCO

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

Constant Summary collapse

BLOOD_TYPE =
k %w(A B O AB)
LICENSE_CATEGORY =
k %w(A B C)

Constants included from IdentificationES

Faker::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



27
28
29
30
# File 'lib/ffakerer/identification_es_co.rb', line 27

def blood_type #RH
  sign = %w(+ -).shuffle.shift
  BLOOD_TYPE.rand.concat sign
end

#driver_license_categoryObject



20
21
22
23
24
25
# File 'lib/ffakerer/identification_es_co.rb', line 20

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

#drivers_licenseObject Also known as: id



13
14
15
16
# File 'lib/ffakerer/identification_es_co.rb', line 13

def drivers_license
  how_many_numbers = 6 + rand(8)
  Faker.numerify("#" * how_many_numbers)
end

#expedition_dateObject



32
33
34
35
# File 'lib/ffakerer/identification_es_co.rb', line 32

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