Sha256: b223a7ea0cd8432059e738c917c5410a491683123bd6de811960f7112dc2b4e5

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

# encoding: utf-8

require 'ffaker/identification_es'

module Faker
  module IdentificationESCO
    include IdentificationES

    extend ModuleUtils
    require "date"
    extend self

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

  alias_method :id, :drivers_license

    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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-1.30.0 lib/ffaker/identification_es_co.rb
ffaker-1.25.0 lib/ffaker/identification_es_co.rb
ffaker-1.24.0 lib/ffaker/identification_es_co.rb
ffaker-1.23.0 lib/ffaker/identification_es_co.rb
ffaker-1.22.1 lib/ffaker/identification_es_co.rb
ffaker-1.22.0 lib/ffaker/identification_es_co.rb