Class: Arbetsformedlingen::SalaryTypeCode

Inherits:
Object
  • Object
show all
Defined in:
lib/arbetsformedlingen/codes/salary_type_code.rb

Constant Summary collapse

CODE_MAP =
{
  'fixed' => '1',
  'fixed_and_commission' => '2',
  'commission' => '3',
}.freeze
CODES =
Set.new(CODE_MAP.values).freeze

Class Method Summary collapse

Class Method Details

.to_code(value) ⇒ Object



15
16
17
# File 'lib/arbetsformedlingen/codes/salary_type_code.rb', line 15

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

.valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/arbetsformedlingen/codes/salary_type_code.rb', line 19

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