README.md in countries-5.4.0 vs README.md in countries-5.5.0

- old
+ new

@@ -130,12 +130,24 @@ c.states # => {"CO" => {"name" => "Colorado", "names" => "Colorado"}, ... } # Get specific translations for the country subdivisions c.subdivision_names_with_codes('es') #=> [ ..., ["Nuevo Hampshire", "NH"], ["Nueva Jersey", "NJ"], ... ] + +# Subdivision code with translations for all loaded locales +c.subdivisions['NY'].code_with_translations #=> {"NY"=>{"en"=>"New York"}, ...} ``` +`#find_subdivision_by_name` Find a country's state using its code or name in any translation + +```ruby +> ISO3166::Country.new("IT").find_subdivision_by_name("Toscana").geo + => {"latitude"=>43.771389, "longitude"=>11.254167, ...Β } +> ISO3166::Country.new("IT").find_subdivision_by_name("Tuscany").geo + => {"latitude"=>43.771389, "longitude"=>11.254167, ...Β } +``` + ### Location ```ruby c.latitude # => "37.09024" c.longitude # => "-95.712891" @@ -204,21 +216,49 @@ ```ruby c.in_eu_vat? # => false ``` -## Country Code in Emoji +### GDPR Compliant (European Economic Area Membership or UK) ```ruby +c.gdpr_compliant? # => false +``` + +### Country Code in Emoji + +```ruby c = Country['MY'] c.emoji_flag # => "πŸ‡²πŸ‡Ύ" ``` ### Plucking multiple attributes ```ruby ISO3166::Country.pluck(:alpha2, :iso_short_name) # => [["AD", "Andorra"], ["AE", "United Arab Emirates"], ... ``` + +`.collect_countries_with` allows to collect various countries' informations using any valid method and query value: +```ruby +> ISO3166::Country.collect_countries_with("VR",:subdivisions,:common_name) + => ["Italy", "Monaco"] +> ISO3166::Country.collect_countries_with("Caribbean",:subregion,:languages_spoken).flatten.uniq + => ["en", "fr", "es", "ht", "nl"] +> ISO3166::Country.collect_countries_with("Oceania",:region,:international_prefix).uniq + => ["00", "011", "0011", "19", "05"] +> ISO3166::Country.collect_countries_with("Antarctica",:continent,:emoji_flag) + => ["πŸ‡¦πŸ‡Ά", "πŸ‡¬πŸ‡Έ", "πŸ‡§πŸ‡»", "πŸ‡ΉπŸ‡«", "πŸ‡­πŸ‡²"] +> ISO3166::Country.collect_countries_with("πŸ‡ΈπŸ‡¨",:emoji_flag,:common_name) + => ["Seychelles"] +``` + +`.collect_likely_countries_by_subdivision_name` allows to lookup all countries having the given state code or state name (in any translation) + +```ruby +ISO3166::Country.collect_likely_countries_by_subdivision_name("San JosΓ©",:common_name) + => ["Costa Rica", "Uruguay"] +``` + ## Currencies To enable currencies extension please add the following to countries initializer.