2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-26 11:34:55 +02:00
|
|
|
class CodeInsee
|
|
|
|
def initialize(code_insee)
|
|
|
|
@code_insee = code_insee
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_departement
|
|
|
|
dept = @code_insee.strip.first(2)
|
|
|
|
if dept < "97"
|
|
|
|
dept
|
|
|
|
else
|
|
|
|
@code_insee.strip.first(3)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|