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
-
#blood_type ⇒ Object
RH.
- #driver_license_category ⇒ Object
- #drivers_license ⇒ Object (also: #id)
- #expedition_date ⇒ Object
Methods included from ModuleUtils
Methods included from RandomUtils
#fetch_sample, #rand, #shuffle
Methods included from IdentificationES
Instance Method Details
#blood_type ⇒ Object
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_category ⇒ Object
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' ? 1 + rand(2) : 1 + rand(3) "#{category}#{num}" end |
#drivers_license ⇒ Object 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_date ⇒ Object
35 36 37 38 |
# File 'lib/ffaker/identification_es_co.rb', line 35 def expedition_date today = Date.today today - rand(today.year) end |