class Arbetsformedlingen::OccupationCode
Constants
- CODES_MAP_INVERTED
- CODE_MAP
- DATA_PATH
Public Class Methods
normalize(name)
click to toggle source
# File lib/arbetsformedlingen/codes/occupation_code.rb, line 22 def self.normalize(name) name.to_s.strip end
to_code(name)
click to toggle source
# File lib/arbetsformedlingen/codes/occupation_code.rb, line 11 def self.to_code(name) normalized = normalize(name) CODE_MAP.fetch(normalized) do normalized if CODES_MAP_INVERTED[normalized] end end
to_form_array(name_only: false)
click to toggle source
# File lib/arbetsformedlingen/codes/occupation_code.rb, line 26 def self.to_form_array(name_only: false) return CODE_MAP.to_a unless name_only CODE_MAP.map { |name, _code| [name, name] } end
valid?(name)
click to toggle source
# File lib/arbetsformedlingen/codes/occupation_code.rb, line 18 def self.valid?(name) !to_code(name).nil? end