class ActiveUtils::CountryCode

def detect_format

def detect_format
  case @value
  when /^[[:alpha:]]{2}$/
    @format = :alpha2
  when /^[[:alpha:]]{3}$/
    @format = :alpha3
  when /^[[:digit:]]{3}$/
    @format = :numeric
  else
    raise CountryCodeFormatError, "The country code is not formatted correctly #{@value}"
  end
end

def initialize(value)

def initialize(value)
  @value = value.to_s.upcase
  detect_format
end

def to_s

def to_s
  value
end