module Arbetsformedlingen::DriversLicenseCode

Constants

CODES

Public Class Methods

codes() click to toggle source
# File lib/arbetsformedlingen/codes/drivers_license_code.rb, line 12
def self.codes
  CODES.to_a
end
normalize(drivers_license) click to toggle source
# File lib/arbetsformedlingen/codes/drivers_license_code.rb, line 24
def self.normalize(drivers_license)
  to_a(drivers_license).join(',')
end
to_a(drivers_license) click to toggle source
# File lib/arbetsformedlingen/codes/drivers_license_code.rb, line 28
def self.to_a(drivers_license)
  drivers_license.to_s.
    split(',').
    map(&:strip).
    reject(&:empty?).
    map(&:upcase)
end
to_code(drivers_license) click to toggle source
# File lib/arbetsformedlingen/codes/drivers_license_code.rb, line 16
def self.to_code(drivers_license)
  normalize(drivers_license)
end
valid?(drivers_license) click to toggle source
# File lib/arbetsformedlingen/codes/drivers_license_code.rb, line 20
def self.valid?(drivers_license)
  to_a(drivers_license).all? { |dl| CODES.include?(dl) }
end