Method: ISO3166::CountryClassMethods#new

Defined in:
lib/countries/country/class_methods.rb

#new(country_data) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/countries/country/class_methods.rb', line 20

def new(country_data)
  return super if country_data.is_a?(Hash)

  country_code = country_data.to_s
  country_code = country_code.upcase if country_code.match?(/[a-z]/)

  super if codes.include?(country_code)
end