Class: Arbetsformedlingen::CountryCode
- Inherits:
-
Object
- Object
- Arbetsformedlingen::CountryCode
- Defined in:
- lib/arbetsformedlingen/codes/country_code.rb
Constant Summary collapse
- CODES =
CSV.read( File.('../../../data/country-codes.csv', __dir__) ).to_h.freeze
- COUNTRY_CODES =
Set.new(CODES.values).freeze
Class Method Summary collapse
Class Method Details
.normalize(country_code) ⇒ Object
22 23 24 |
# File 'lib/arbetsformedlingen/codes/country_code.rb', line 22 def self.normalize(country_code) country_code.to_s.upcase end |
.to_code(country_code) ⇒ Object
14 15 16 |
# File 'lib/arbetsformedlingen/codes/country_code.rb', line 14 def self.to_code(country_code) normalize(country_code) end |
.valid?(country_code) ⇒ Boolean
18 19 20 |
# File 'lib/arbetsformedlingen/codes/country_code.rb', line 18 def self.valid?(country_code) COUNTRY_CODES.include?(normalize(country_code)) end |