class ActiveUtils::Country

def self.find(name)

def self.find(name)
  raise InvalidCountryCodeError, "Cannot lookup country for an empty name" if name.blank?
  case name.length
  when 2, 3
    upcase_name = name.upcase
    country_code = CountryCode.new(name)
    country = COUNTRIES.detect{|c| c[country_code.format] == upcase_name }
  else
    country = COUNTRIES.detect{|c| c[:name] == name }
  end
  raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
  Country.new(country.dup)
end

def ==(other)

def ==(other)
  (@name == other.name)
end

def code(format)

def code(format)
  @codes.detect{|c| c.format == format}
end

def hash

def hash
  @name.hash
end

def initialize(options = {})

def initialize(options = {})
  requires!(options, :name, :alpha2, :alpha3, :numeric)
  @name = options.delete(:name)
  @codes = options.collect{|k,v| CountryCode.new(v)}
end

def to_s

def to_s
  @name
end

def uses_postal_codes?

def uses_postal_codes?
  !COUNTRIES_THAT_DO_NOT_USE_POSTALCODES.include?(code(:alpha2).value)
end