Sha256: dcc7d924b2b0df6edd51665ccd8c4d287a97bdbd871168a73de0de2cf7d860f7

Contents?: true

Size: 404 Bytes

Versions: 8

Compression:

Stored size: 404 Bytes

Contents

require 'set'

module Arbetsformedlingen
  class ExperienceRequiredCode
    CODES_MAP = {
      'true' => '1',
      'false' => '4'
    }.freeze
    CODES_MAP_INVERTED = CODES_MAP.invert.freeze

    def self.to_code(value)
      CODES_MAP.fetch(value.to_s) do
        value.to_s if CODES_MAP_INVERTED[value.to_s]
      end
    end

    def self.valid?(value)
      !to_code(value).nil?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
arbetsformedlingen-0.5.0 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.4.1 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.4.0 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.3.0 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.2.0 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.1.2 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.1.1 lib/arbetsformedlingen/codes/experience_required_code.rb
arbetsformedlingen-0.1.0 lib/arbetsformedlingen/codes/experience_required_code.rb