Sha256: c7a0d1f6d08b69dc9a730a718b7d4ee5428e7da6c84c5d25c38dee56db57e524

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

require 'date'

module FFakerTW
  module IdentificationESCO
    include IdentificationES

    extend ModuleUtils
    extend self

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

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

    alias id drivers_license

    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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffakerTW-0.1.0 lib/ffakerTW/identification_es_co.rb