Sha256: a1e7c1dbb5d81b395ad2d3ecaefdf6a6647bfb49fdaf17d0d72374e315e0d2a4

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

# frozen_string_literal: true

require 'set'

module Arbetsformedlingen
  class SalaryTypeCode
    CODE_MAP = {
      'fixed' => '1',
      'fixed_and_commission' => '2',
      'commission' => '3',
    }.freeze

    CODES = Set.new(CODE_MAP.values).freeze

    def self.to_code(value)
      CODE_MAP.fetch(value.to_s, nil)
    end

    def self.valid?(value)
      CODES.include?(value.to_s)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arbetsformedlingen-0.7.0 lib/arbetsformedlingen/codes/salary_type_code.rb
arbetsformedlingen-0.6.0 lib/arbetsformedlingen/codes/salary_type_code.rb