countries 4.2.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/tests.yml +1 -5
- data/.rubocop.yml +40 -1
- data/.rubocop_todo.yml +8 -41
- data/CHANGELOG.md +33 -5
- data/Gemfile +5 -3
- data/LICENSE +3 -1
- data/README.markdown +34 -18
- data/Rakefile +15 -31
- data/bin/console +1 -0
- data/countries.gemspec +12 -10
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/oc.json +1 -1
- data/lib/countries/cache/locales/ti.json +1 -1
- data/lib/countries/cache/locales/zu.json +1 -1
- data/lib/countries/configuration.rb +2 -0
- data/lib/countries/country/class_methods.rb +12 -97
- data/lib/countries/country/currency_methods.rb +2 -0
- data/lib/countries/country/emoji.rb +2 -3
- data/lib/countries/country/finder_methods.rb +81 -0
- data/lib/countries/country.rb +3 -40
- data/lib/countries/data/countries/AE.yaml +1 -1
- data/lib/countries/data/countries/KN.yaml +0 -1
- data/lib/countries/data/subdivisions/AD.yaml +21 -21
- data/lib/countries/data/subdivisions/AF.yaml +2 -2
- data/lib/countries/data/subdivisions/AG.yaml +1 -1
- data/lib/countries/data/subdivisions/AI.yaml +98 -98
- data/lib/countries/data/subdivisions/AL.yaml +82 -626
- data/lib/countries/data/subdivisions/AZ.yaml +5 -5
- data/lib/countries/data/subdivisions/BA.yaml +11 -11
- data/lib/countries/data/subdivisions/BD.yaml +8 -8
- data/lib/countries/data/subdivisions/BE.yaml +2 -2
- data/lib/countries/data/subdivisions/BF.yaml +13 -13
- data/lib/countries/data/subdivisions/BI.yaml +3 -3
- data/lib/countries/data/subdivisions/BM.yaml +77 -77
- data/lib/countries/data/subdivisions/BS.yaml +22 -22
- data/lib/countries/data/subdivisions/BW.yaml +7 -7
- data/lib/countries/data/subdivisions/BY.yaml +1 -1
- data/lib/countries/data/subdivisions/CD.yaml +19 -19
- data/lib/countries/data/subdivisions/CG.yaml +1 -1
- data/lib/countries/data/subdivisions/CI.yaml +14 -14
- data/lib/countries/data/subdivisions/CK.yaml +77 -77
- data/lib/countries/data/subdivisions/CN.yaml +0 -107
- data/lib/countries/data/subdivisions/CV.yaml +9 -9
- data/lib/countries/data/subdivisions/DK.yaml +1 -0
- data/lib/countries/data/subdivisions/DO.yaml +11 -11
- data/lib/countries/data/subdivisions/EE.yaml +78 -2
- data/lib/countries/data/subdivisions/EH.yaml +12 -12
- data/lib/countries/data/subdivisions/ES.yaml +17 -17
- data/lib/countries/data/subdivisions/FI.yaml +16 -16
- data/lib/countries/data/subdivisions/FJ.yaml +14 -14
- data/lib/countries/data/subdivisions/GB.yaml +21 -20
- data/lib/countries/data/subdivisions/GH.yaml +7 -7
- data/lib/countries/data/subdivisions/GL.yaml +6 -6
- data/lib/countries/data/subdivisions/GN.yaml +7 -7
- data/lib/countries/data/subdivisions/GQ.yaml +1 -0
- data/lib/countries/data/subdivisions/GR.yaml +1 -1
- data/lib/countries/data/subdivisions/GW.yaml +3 -3
- data/lib/countries/data/subdivisions/HT.yaml +1 -1
- data/lib/countries/data/subdivisions/ID.yaml +41 -41
- data/lib/countries/data/subdivisions/IE.yaml +1 -2
- data/lib/countries/data/subdivisions/IN.yaml +4 -3
- data/lib/countries/data/subdivisions/IQ.yaml +1 -1
- data/lib/countries/data/subdivisions/IR.yaml +2 -1
- data/lib/countries/data/subdivisions/IS.yaml +72 -0
- data/lib/countries/data/subdivisions/IT.yaml +7 -8
- data/lib/countries/data/subdivisions/KG.yaml +1 -1
- data/lib/countries/data/subdivisions/KH.yaml +1 -1
- data/lib/countries/data/subdivisions/KN.yaml +2 -2
- data/lib/countries/data/subdivisions/KP.yaml +12 -12
- data/lib/countries/data/subdivisions/KR.yaml +1 -1
- data/lib/countries/data/subdivisions/KZ.yaml +1 -1
- data/lib/countries/data/subdivisions/LA.yaml +1 -1
- data/lib/countries/data/subdivisions/LB.yaml +2 -2
- data/lib/countries/data/subdivisions/LC.yaml +10 -10
- data/lib/countries/data/subdivisions/LK.yaml +9 -9
- data/lib/countries/data/subdivisions/LR.yaml +2 -2
- data/lib/countries/data/subdivisions/LT.yaml +60 -60
- data/lib/countries/data/subdivisions/LU.yaml +1 -1
- data/lib/countries/data/subdivisions/LV.yaml +1 -1
- data/lib/countries/data/subdivisions/MA.yaml +35 -35
- data/lib/countries/data/subdivisions/MC.yaml +17 -17
- data/lib/countries/data/subdivisions/MD.yaml +740 -740
- data/lib/countries/data/subdivisions/ME.yaml +3 -3
- data/lib/countries/data/subdivisions/MH.yaml +2 -2
- data/lib/countries/data/subdivisions/ML.yaml +2 -2
- data/lib/countries/data/subdivisions/MM.yaml +1 -1
- data/lib/countries/data/subdivisions/MR.yaml +3 -3
- data/lib/countries/data/subdivisions/MV.yaml +8 -8
- data/lib/countries/data/subdivisions/MW.yaml +4 -4
- data/lib/countries/data/subdivisions/MX.yaml +1 -1
- data/lib/countries/data/subdivisions/NL.yaml +6 -6
- data/lib/countries/data/subdivisions/NO.yaml +1 -0
- data/lib/countries/data/subdivisions/NP.yaml +12 -12
- data/lib/countries/data/subdivisions/NZ.yaml +1 -1
- data/lib/countries/data/subdivisions/OM.yaml +6 -6
- data/lib/countries/data/subdivisions/PG.yaml +3 -3
- data/lib/countries/data/subdivisions/PH.yaml +16 -16
- data/lib/countries/data/subdivisions/PK.yaml +2 -2
- data/lib/countries/data/subdivisions/PS.yaml +16 -16
- data/lib/countries/data/subdivisions/QA.yaml +2 -2
- data/lib/countries/data/subdivisions/RS.yaml +2 -2
- data/lib/countries/data/subdivisions/SC.yaml +4 -2
- data/lib/countries/data/subdivisions/SH.yaml +1 -1
- data/lib/countries/data/subdivisions/SI.yaml +19 -19
- data/lib/countries/data/subdivisions/SJ.yaml +14 -14
- data/lib/countries/data/subdivisions/SL.yaml +1 -1
- data/lib/countries/data/subdivisions/SN.yaml +3 -3
- data/lib/countries/data/subdivisions/SS.yaml +10 -10
- data/lib/countries/data/subdivisions/ST.yaml +6 -0
- data/lib/countries/data/subdivisions/TD.yaml +6 -6
- data/lib/countries/data/subdivisions/TH.yaml +1 -1
- data/lib/countries/data/subdivisions/TJ.yaml +2 -2
- data/lib/countries/data/subdivisions/TK.yaml +21 -21
- data/lib/countries/data/subdivisions/TM.yaml +1 -1
- data/lib/countries/data/subdivisions/TT.yaml +2 -2
- data/lib/countries/data/subdivisions/TV.yaml +1 -1
- data/lib/countries/data/subdivisions/TW.yaml +3 -17
- data/lib/countries/data/subdivisions/TZ.yaml +5 -5
- data/lib/countries/data/subdivisions/UG.yaml +59 -52
- data/lib/countries/data/subdivisions/UM.yaml +0 -10
- data/lib/countries/data/subdivisions/WF.yaml +3 -13
- data/lib/countries/data/subdivisions/YE.yaml +3 -3
- data/lib/countries/data/subdivisions/ZA.yaml +2 -2
- data/lib/countries/data/subdivisions/ZM.yaml +1 -1
- data/lib/countries/data.rb +34 -37
- data/lib/countries/global.rb +2 -0
- data/lib/countries/iso3166.rb +3 -0
- data/lib/countries/kwarg_struct.rb +2 -0
- data/lib/countries/mongoid.rb +2 -0
- data/lib/countries/sources/cldr/downloader.rb +8 -8
- data/lib/countries/sources/cldr/subdivision.rb +3 -0
- data/lib/countries/sources/cldr/subdivision_updater.rb +23 -17
- data/lib/countries/sources/local/cached_loader.rb +3 -0
- data/lib/countries/sources/local/subdivision.rb +5 -2
- data/lib/countries/sources.rb +2 -0
- data/lib/countries/structure.rb +1 -1
- data/lib/countries/subdivision.rb +2 -0
- data/lib/countries/tasks/geocoding.rake +15 -6
- data/lib/countries/tasks/postal_codes.rake +5 -3
- data/lib/countries/timezones.rb +5 -2
- data/lib/countries/translations.rb +2 -0
- data/lib/countries/version.rb +3 -1
- data/lib/countries.rb +2 -0
- data/spec/00_global_spec.rb +2 -0
- data/spec/configuration_spec.rb +11 -5
- data/spec/country_spec.rb +71 -22
- data/spec/data_spec.rb +24 -18
- data/spec/mongoid_spec.rb +2 -2
- data/spec/perf_spec.rb +16 -16
- data/spec/spec_helper.rb +2 -0
- data/spec/subdivision_spec.rb +6 -4
- data/spec/thread_safety_spec.rb +4 -3
- data/spec/timezone_spec.rb +2 -0
- metadata +18 -45
- data/lib/countries/data/subdivisions/AS.yaml +0 -85
- data/lib/countries/data/subdivisions/AW.yaml +0 -9
- data/lib/countries/data/subdivisions/AX.yaml +0 -51
- data/lib/countries/data/subdivisions/BL.yaml +0 -11
- data/lib/countries/data/subdivisions/CP.yaml +0 -4
- data/lib/countries/data/subdivisions/CW.yaml +0 -9
- data/lib/countries/data/subdivisions/GF.yaml +0 -11
- data/lib/countries/data/subdivisions/GG.yaml +0 -155
- data/lib/countries/data/subdivisions/GP.yaml +0 -11
- data/lib/countries/data/subdivisions/GU.yaml +0 -275
- data/lib/countries/data/subdivisions/HK.yaml +0 -267
- data/lib/countries/data/subdivisions/IC.yaml +0 -4
- data/lib/countries/data/subdivisions/IM.yaml +0 -337
- data/lib/countries/data/subdivisions/JE.yaml +0 -169
- data/lib/countries/data/subdivisions/MF.yaml +0 -9
- data/lib/countries/data/subdivisions/MO.yaml +0 -9
- data/lib/countries/data/subdivisions/MP.yaml +0 -71
- data/lib/countries/data/subdivisions/MQ.yaml +0 -11
- data/lib/countries/data/subdivisions/MS.yaml +0 -43
- data/lib/countries/data/subdivisions/NC.yaml +0 -57
- data/lib/countries/data/subdivisions/PF.yaml +0 -81
- data/lib/countries/data/subdivisions/PM.yaml +0 -39
- data/lib/countries/data/subdivisions/PR.yaml +0 -1107
- data/lib/countries/data/subdivisions/RE.yaml +0 -11
- data/lib/countries/data/subdivisions/SX.yaml +0 -9
- data/lib/countries/data/subdivisions/TA.yaml +0 -4
- data/lib/countries/data/subdivisions/TF.yaml +0 -67
- data/lib/countries/data/subdivisions/VI.yaml +0 -57
- data/lib/countries/data/subdivisions/YT.yaml +0 -247
- data/lib/countries/setup.rb +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"AW":"Aruba","AF":"Afganistan","AO":"Angòla","AI":"Anguilla","AX":"Åland Islands","AL":"Albania","AD":"Andòrra","AE":"Emirats Arabs Units","AR":"Argentina","AM":"Armenia","AS":"Samoa americana","AQ":"Antartica","TF":"Tèrras australas francesas","AG":"Antigua e Barbuda","AU":"Australia","AT":"
|
|
1
|
+
{"AW":"Aruba","AF":"Afganistan","AO":"Angòla","AI":"Anguilla","AX":"Åland Islands","AL":"Albania","AD":"Andòrra","AE":"Emirats Arabs Units","AR":"Argentina","AM":"Armenia","AS":"Samoa americana","AQ":"Antartica","TF":"Tèrras australas francesas","AG":"Antigua e Barbuda","AU":"Australia","AT":"Àustria","AZ":"Azerbaitjan","BI":"Burundi","BE":"Belgica","BJ":"Benin","BQ":"Bonaire, Sant Eustaqui e Saba","BF":"Burkina Faso","BD":"Bangladèsh","BG":"Bulgaria","BH":"Barein","BS":"Bahamas","BA":"Bòsnia e Ercegovina","BL":"Sant Bertomieu","BY":"Bielorussia","BZ":"Belize","BM":"Bermudas","BO":"Bolivia","BR":"Brasil","BB":"Barbada","BN":"Brunei","BT":"Botan","BV":"Illa Bouvet","BW":"Botswana","CF":"Republica de Centrafrica","CA":"Canadà","CC":"Illas Cocos (Keeling)","CH":"Soïssa","CL":"Chile","CN":"China","CI":"Còsta d'Evòri","CM":"Cameron","CD":"Còngo, Republica Democratica de","CG":"Còngo","CK":"Illas Cook","CO":"Colombia","KM":"Comòras","CV":"Cap Verd","CR":"Còsta Rica","CU":"Cuba","CW":"Curaçao","CX":"Illa Cristmas","KY":"Illas Caiman","CY":"Chipre","CZ":"Chequia","DE":"Alemanha","DJ":"Jiboti","DM":"Dominica","DK":"Danemarc","DO":"Republica Dominicana","DZ":"Argeria","EC":"Eqüator","EG":"Egipte","ER":"Eritrèa","EH":"Sahara occidental","ES":"Espanha","EE":"Estònia","ET":"Etiopia","FI":"Finlàndia","FJ":"Fiji","FK":"Illas Falkand (Malvinas)","FR":"França","FO":"Illas Feròe","FM":"Micronesia, Estats Federats de","GA":"Gabon","GB":"Reialme Unit","GE":"Georgia","GG":"Guernsey","GH":"Gana","GI":"Gibartar","GN":"Guinèa","GP":"Guadalope","GM":"Gàmbia","GW":"Guinèa-Bissau","GQ":"Guinèa eqüatoriala","GR":"Grècia","GD":"Granada","GL":"Groenlàndia","GT":"Guatemala","GF":"Guaiana francesa","GU":"Guam","GY":"Guyana","HK":"Hong Kong","HM":"Heard Island and McDonald Islands","HN":"Honduras","HR":"Croàcia","HT":"Haití","HU":"Ongria","ID":"Indonesia","IM":"Illa de Man","IN":"Índia","IO":"Territòris britanics de l'ocean indian","IE":"Irlanda","IR":"Republica Dominicana","IQ":"Iraq","IS":"Islàndia","IL":"Israel","IT":"Itàlia","JM":"Jamaica","JE":"Jersei","JO":"Jordania","JP":"Japon","KZ":"Cazacstan","KE":"Kenya","KG":"Kirguizstan","KH":"Cambòtja","KI":"Kiribati","KN":"St. Kitts e Nevis","KR":"Corèa del Sud","KW":"Koweit","LA":"Republica democratica populara del Laos","LB":"Liban","LR":"Libèria","LY":"Libia","LC":"St. Lucia","LI":"Liechtenstein","LK":"Sri Lanka","LS":"Lesoto","LT":"Lituània","LU":"Luxemborg","LV":"Letònia","MO":"Macau","MF":"Sant Martin (Part francesa)","MA":"Marròc","MC":"Mónegue","MD":"Moldàvia","MG":"Madagascar","MV":"Maldivas","MX":"Mexic","MH":"Illas Marshall","MK":"Macedònia del Nòrd","ML":"Mali","MT":"Malta","MM":"Birmania","ME":"Montenegro","MN":"Mongolia","MP":"Illas Marianas del Nòrd","MZ":"Moçambic","MR":"Mauritània","MS":"Montserrat","MQ":"Martinica","MU":"Maurici","MW":"Malawi","MY":"Malàisia","YT":"Maiòta","NA":"Namibia","NC":"Nòva Caledònia","NE":"Nigèr","NF":"Illa Norfolk","NG":"Nigèria","NI":"Nicaragua","NU":"Niue","NL":"Païses Basses","NO":"Norvègia","NP":"Nepal","NR":"Nauru","NZ":"Novèla Zelanda","OM":"Oman","PK":"Paquistan","PA":"Panamà","PN":"Illa de Pitcairn","PE":"Peró","PH":"Filipinas","PW":"Belau","PG":"Papoa Nòva Guinèa","PL":"Polonha","PR":"Puerto Rico","KP":"Corèa del Nòrd","PT":"Portugal","PY":"Paraguai","PS":"Palestina, estat de","PF":"Polinesia francesa","QA":"Qatar","RE":"Réunion","RO":"Romania","RU":"Federacion russa","RW":"Rwanda","SA":"Arabia saudita","SD":"Sodan","SN":"Senegal","SG":"Singapor","GS":"Illas Georgia del Sud e Sandwich del Sud","SH":"Santa Elena, Ascension, e Tristan da Cunha","SJ":"Svalbard e Jan Mayen","SB":"Illas Salomon","SL":"Sierra Leone","SV":"El Salvador","SM":"Sant Marin","SO":"Somalia","PM":"Sant Pèire e Miquelon","RS":"Serbia","SS":"Sodan del Sud","ST":"Sao Tomé e Principe","SR":"Surinam","SK":"Eslovaquia","SI":"Eslovènia","SE":"Suècia","SZ":"Eswatini","SX":"Sant Martin (Part neerlandesa)","SC":"Seichèlas","SY":"Republica Dominicana","TC":"Illas Turcas e Caïcas","TD":"Chad","TG":"Tògo","TH":"Tailàndia","TJ":"Tatgiquistan","TK":"Tokelau","TM":"Turcmenistan","TL":"Timor-Leste","TO":"Tònga","TT":"Trinitat e Tobago","TN":"Tunisia","TR":"Turquia","TV":"Tuvalu","TW":"Taiwan","TZ":"Tanzania","UG":"Oganda","UA":"Ucraïna","UM":"Islas perifericas Menores dels Estats Units","UY":"Uruguai","US":"Estats Units","UZ":"Ozbequistan","VA":"Santa Ses (Estat de la Ciutat de Vatican)","VC":"Sant Vincenç e las Grenadinas","VE":"Veneçuèla","VG":"Illas Verges, britanicas","VI":"illas Verges, EU","VN":"Vietnam","VU":"Vanuatu","WF":"Wallis e Futuna","WS":"Samoa","YE":"Iemèn","ZA":"Sudafrica","ZM":"Zambia","ZW":"Zimbabwe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"AW":"ኣሩባ","AF":"ኣፍጋኒስታን","AO":"ኣንጎላ","AI":"Anguilla","AX":"Åland Islands","AL":"አልባኒያ","AD":"አንዶራ","AE":"የተባበሩት አረብ ኤምሬትስ","AR":"ኣርጀንቲና","AM":"ኣርሜንያ","AS":"American Samoa","AQ":"
|
|
1
|
+
{"AW":"ኣሩባ","AF":"ኣፍጋኒስታን","AO":"ኣንጎላ","AI":"Anguilla","AX":"Åland Islands","AL":"አልባኒያ","AD":"አንዶራ","AE":"የተባበሩት አረብ ኤምሬትስ","AR":"ኣርጀንቲና","AM":"ኣርሜንያ","AS":"American Samoa","AQ":"ኣንታርክቲካ","TF":"የፈረንሳይ ደቡባዊ ግዛቶች","AG":"Antigua and Barbuda","AU":"ኣውስትራልያ","AT":"ኦስትሪያ","AZ":"ኣዘርባጃን","BI":"ቡሩንዲ","BE":"ቤልጄም","BJ":"ቤኒን","BQ":"Bonaire, Sint Eustatius and Saba","BF":"ቡርኪና ፋሶ","BD":"ባንግላዴሽ","BG":"ቡልጋሪያ","BH":"ባህሬን","BS":"ባሃማስ","BA":"ቦስኒያ እና ሄርዞጎቪኒያ","BL":"Saint Barthélemy","BY":"ቤላሩስ","BZ":"ቤሊዝ","BM":"ቤርሙዳ","BO":"ቦሊቭያ","BR":"ብራዚል","BB":"ባርቤዶስ","BN":"Brunei Darussalam","BT":"ቡህታን","BV":"Bouvet Island","BW":"ቦትስዋና","CF":"ሪፓብሊክ ማእከላይ ኣፍሪቃ","CA":"ካናዳ","CC":"Cocos (Keeling) Islands","CH":"ስዊዘርላንድ","CL":"ቺሊ","CN":"ቻይና","CI":"Côte d'Ivoire","CM":"ካሜሩን","CD":"ደሞክራስያዊት ሪፓብሊክ ኮንጎ","CG":"ኮንጎ","CK":"Cook Islands","CO":"ኮሎምብያ","KM":"ኮሞሮስ","CV":"Cabo Verde","CR":"ኮስታ ሪካ","CU":"ኩባ","CW":"Curaçao","CX":"Christmas Island","KY":"Cayman Islands","CY":"ሳይፕረስ","CZ":"Czechia","DE":"ጀርመን","DJ":"ጂቡቲ","DM":"ዶሚኒካ","DK":"ዴንማርክ","DO":"ዶሚኒካዊት ሪፓብሊክ","DZ":"አልጄሪያ","EC":"ኤኳዶር","EG":"ግብጺ","ER":"ኤርትራ","EH":"ምዕራባዊ ሳህራ","ES":"ስጳኛ","EE":"ኤስቶኒያ","ET":"ኢትዮጵያ","FI":"ፊንላንድ","FJ":"ፊጂ","FK":"Falkland Islands (Malvinas)","FR":"ፈረንሳ","FO":"Faroe Islands","FM":"Micronesia, Federated States of","GA":"Gabon","GB":"ብሪጣንያ","GE":"ጆርጂያ","GG":"Guernsey","GH":"Ghana","GI":"Gibraltar","GN":"ጊኒ","GP":"Guadeloupe","GM":"ጋምቢያ","GW":"ቢሳዎ","GQ":"ኢኳቶሪያል ጊኒ","GR":"ግሪኽ","GD":"Grenada","GL":"Greenland","GT":"ጓቲማላ","GF":"የፈረንሳይ ጉዊአና","GU":"Guam","GY":"ጉያና","HK":"ሆንግ ኮንግ","HM":"Heard Island and McDonald Islands","HN":"ሆንዱራስ","HR":"ክሮኤሽያ","HT":"ሀይቲ","HU":"ሀንጋሪ","ID":"ኢንዶኔዢያ","IM":"Isle of Man","IN":"ህንዲ","IO":"British Indian Ocean Territory","IE":"አየርላንድ","IR":"Iran, Islamic Republic of","IQ":"ዒራቅ","IS":"አይስላንድ","IL":"እስራኤል","IT":"ኢጣልያ","JM":"ጃማይካ","JE":"Jersey","JO":"ጆርዳን","JP":"ጃፓን","KZ":"Kazakhstan","KE":"ኬንያ","KG":"Kyrgyzstan","KH":"ካምቦዲያ","KI":"Kiribati","KN":"Saint Kitts and Nevis","KR":"South Korea","KW":"ክዌት","LA":"Lao People's Democratic Republic","LB":"ሊባኖስ","LR":"Liberia","LY":"ሊብያ","LC":"Saint Lucia","LI":"Liechtenstein","LK":"ስሪ ላንካ","LS":"Lesotho","LT":"ሊቱዌኒያ","LU":"Luxembourg","LV":"ላትቪያ","MO":"Macao","MF":"Saint Martin (French part)","MA":"ሞሮኮ","MC":"Monaco","MD":"Moldova","MG":"ማዳጋስካር","MV":"Maldives","MX":"ሜክሲኮ","MH":"Marshall Islands","MK":"North Macedonia","ML":"ማሊ","MT":"ማልታ","MM":"Myanmar","ME":"Montenegro","MN":"ሞንጎልያ","MP":"Northern Mariana Islands","MZ":"ሞዛምቢክ","MR":"ሞሪቴኒያ","MS":"Montserrat","MQ":"Martinique","MU":"ማሩሸስ","MW":"ማላዊ","MY":"ማሌዢያ","YT":"Mayotte","NA":"ናሚቢያ","NC":"ኒው ካሌዶኒያ","NE":"ናይጀር","NF":"Norfolk Island","NG":"ናይጄሪያ","NI":"ኒካራጓ","NU":"Niue","NL":"ኔዘርላንድ","NO":"ኖርወይ","NP":"ኔፓል","NR":"Nauru","NZ":"ኒው ዚላንድ","OM":"Oman","PK":"ፓኪስታን","PA":"ፓናማ","PN":"Pitcairn","PE":"ፔሩ","PH":"Philippines","PW":"Palau","PG":"ፓፑዋ ኒው ጊኒ","PL":"ፖላንድ","PR":"ፖርታ ሪኮ","KP":"North Korea","PT":"ፖርቱጋል","PY":"ፓራጓይ","PS":"Palestine, State of","PF":"የፈረንሳይ ፖሊኔዢያ","QA":"Qatar","RE":"Réunion","RO":"ሮሜኒያ","RU":"Russian Federation","RW":"ሩዋንዳ","SA":"ሰዑዲ ዓረብ","SD":"ሱዳን","SN":"ሴኔጋል","SG":"ሲንጋፖር","GS":"South Georgia and the South Sandwich Islands","SH":"Saint Helena, Ascension and Tristan da Cunha","SJ":"Svalbard and Jan Mayen","SB":"Solomon Islands","SL":"Sierra Leone","SV":"ኤል ሳልቫዶር","SM":"San Marino","SO":"ሶማልያ","PM":"Saint Pierre and Miquelon","RS":"Serbia","SS":"ደቡብ ሱዳን","ST":"Sao Tome and Principe","SR":"ሱሪናም","SK":"ስሎቫኪያ","SI":"ስሎቬኒያ","SE":"ስወደን","SZ":"Eswatini","SX":"Sint Maarten (Dutch part)","SC":"Seychelles","SY":"Syrian Arab Republic","TC":"Turks and Caicos Islands","TD":"ቻድ","TG":"ቶጎ","TH":"ታይላንድ","TJ":"ታጃኪስታን","TK":"Tokelau","TM":"Turkmenistan","TL":"ምስራቅ ቲሞር","TO":"Tonga","TT":"ትሪኒዳድን ቶባጎን","TN":"ቱኒዝያ","TR":"ቱርኪ","TV":"Tuvalu","TW":"ታይዋን","TZ":"ታንዛንያ","UG":"ዩጋንዳ","UA":"ዩክረይን","UM":"United States Minor Outlying Islands","UY":"ኡራጓይ","US":"ኣመሪካ","UZ":"ኡዝበኪስታን","VA":"Holy See (Vatican City State)","VC":"Saint Vincent and the Grenadines","VE":"ቬኔዝዌላ","VG":"Virgin Islands, British","VI":"Virgin Islands, U.S.","VN":"ቬትናም","VU":"Vanuatu","WF":"Wallis and Futuna","WS":"Samoa","YE":"የመን","ZA":"ደቡብ ኣፍሪቃ","ZM":"ዛምቢያ","ZW":"ዚምባብዌ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"AW":"Aruba","AF":"I-Afganistani","AO":"I-Angola","AI":"Anguilla","AX":"Åland Islands","AL":"I-Albaniya","AD":"I-Andora","AE":"United Arab Emirates","AR":"I-Argentina","AM":"Armenia","AS":"American Samoa","AQ":"Antarctica","TF":"French Southern Territories","AG":"Antigua no Barbuda","AU":"I-
|
|
1
|
+
{"AW":"Aruba","AF":"I-Afganistani","AO":"I-Angola","AI":"Anguilla","AX":"Åland Islands","AL":"I-Albaniya","AD":"I-Andora","AE":"United Arab Emirates","AR":"I-Argentina","AM":"Armenia","AS":"American Samoa","AQ":"Antarctica","TF":"French Southern Territories","AG":"Antigua no Barbuda","AU":"I-Ostreliya","AT":"I-Ostriya","AZ":"I-Azerbayijani","BI":"IBurundi","BE":"Isi-Bhelijiyamu","BJ":"IBenini","BQ":"Bonaire, Sint Eustatius and Saba","BF":"IBukhina Faso","BD":"Isi-Bhangladeshi","BG":"IBulgariya","BH":"Bahrain","BS":"Bahamas","BA":"IBhosniya neHerzegovina","BL":"Saint Barthélemy","BY":"IBelarusi","BZ":"Belize","BM":"Bermuda","BO":"I Boliviya","BR":"IBrazili","BB":"I-Barbados","BN":"Brunei Darussalam","BT":"Bhutan","BV":"Bouvet Island","BW":"IButswana","CF":"Central African Republic","CA":"I Khanada","CC":"Cocos (Keeling) Islands","CH":"I-Switzerland","CL":"I-Chile","CN":"Isi-Shayina","CI":"Côte d'Ivoire","CM":"IKamerooni","CD":"Congo, The Democratic Republic of the","CG":"Congo","CK":"Cook Islands","CO":"IKolombiya","KM":"IsiKhomorosi","CV":"Cabo Verde","CR":"Costa Rica","CU":"Cuba","CW":"Curaçao","CX":"Christmas Island","KY":"Cayman Islands","CY":"Cyprus","CZ":"Czechia","DE":"IJalimani","DJ":"IJibuthi","DM":"Dominica","DK":"IDenimaki","DO":"Ulawulo lokuziphatha kwe Dominikhani","DZ":"IAljiriya","EC":"Ecuador","EG":"IGibhithe","ER":"I-Eritrea","EH":"Western Sahara","ES":"ISpeyini","EE":"I-Estoniya","ET":"I-Ithiopia","FI":"IFinlandi","FJ":"IFiji","FK":"Falkland Islands (Malvinas)","FR":"IFulansi","FO":"Faroe Islands","FM":"Micronesia, Federated States of","GA":"IGaboni","GB":"Umbuso Ohlangeneyo","GE":"Georgia","GG":"Guernsey","GH":"IGana","GI":"Gibraltar","GN":"IGini","GP":"Guadeloupe","GM":"Gambia","GW":"IGini Bisawu","GQ":"IGini Enkabazwe","GR":"IGreki","GD":"I-Grenada","GL":"Greenland","GT":"I-Guwathemala","GF":"French Guiana","GU":"Guam","GY":"Guyana","HK":"Hong Kong","HM":"Heard Island and McDonald Islands","HN":"I-Hondurasi","HR":"IKrowati","HT":"Haiti","HU":"I-Hungariya","ID":"I-Indonesia","IM":"Isle of Man","IN":"India","IO":"British Indian Ocean Territory","IE":"I-Ayilendi","IR":"Iran, Islamic Republic of","IQ":"I-Iraki","IS":"I-Ayisilandi","IL":"Isreyili","IT":"ITaliya","JM":"Jamaica","JE":"Jersey","JO":"Jordan","JP":"IJaphani","KZ":"Kazakhstan","KE":"IKenya","KG":"Kyrgyzstan","KH":"Cambodia","KI":"Kiribati","KN":"Saint Kitts and Nevis","KR":"South Korea","KW":"Kuwait","LA":"Lao People's Democratic Republic","LB":"Lebanon","LR":"ILiberia","LY":"ILibiya","LC":"Saint Lucia","LI":"Liechtenstein","LK":"Sri Lanka","LS":"OSotho","LT":"ILithuwaniya","LU":"I-Luxembourg","LV":"ILatviya","MO":"Macao","MF":"Saint Martin (French part)","MA":"IMorokho","MC":"Monaco","MD":"Moldova","MG":"IMadagasika","MV":"Maldives","MX":"IMekisiko","MH":"Marshall Islands","MK":"North Macedonia","ML":"IMali","MT":"IMalta","MM":"Myanmar","ME":"IMontenegro","MN":"Mongolia","MP":"Northern Mariana Islands","MZ":"IMozambiki","MR":"IMoritaniya","MS":"Montserrat","MQ":"Martinique","MU":"IMorishisi","MW":"IMalawi","MY":"Malaysia","YT":"IMayotte","NA":"INamibhiya","NC":"New Caledonia","NE":"INayighe","NF":"Norfolk Island","NG":"INigeria","NI":"Nicaragua","NU":"Niue","NL":"I-Netherlands","NO":"INoki","NP":"Nepal","NR":"Nauru","NZ":"INyuzilandi","OM":"Oman","PK":"IPakistani","PA":"Panama","PN":"Pitcairn","PE":"I-Peru","PH":"Philippines","PW":"Palau","PG":"Papua New Guinea","PL":"IPolandi","PR":"Puerto Rico","KP":"North Korea","PT":"IPhothugali","PY":"I-Paraguwayi","PS":"Palestine, State of","PF":"French Polynesia","QA":"Qatar","RE":"IRiyunion","RO":"I-Romaniya","RU":"Russian Federation","RW":"IRuwanda","SA":"Saudi Arabia","SD":"ISudan","SN":"ISenegal","SG":"Singapore","GS":"South Georgia and the South Sandwich Islands","SH":"Saint Helena, Ascension and Tristan da Cunha","SJ":"Svalbard and Jan Mayen","SB":"Solomon Islands","SL":"ISiera Liyoni","SV":"El Salvador","SM":"USanti Marino","SO":"ISomalia","PM":"Saint Pierre and Miquelon","RS":"ISerbiya","SS":"ISudan yaseNingizimu","ST":"ISawu Tome noPhrinitshipeyi","SR":"Suriname","SK":"ISlovaki","SI":"ISloveniya","SE":"ISwidi","SZ":"Eswatini","SX":"Sint Maarten (Dutch part)","SC":"IsiSeyisheli","SY":"Syrian Arab Republic","TC":"Turks and Caicos Islands","TD":"ITshedi","TG":"ITogo","TH":"I-Thayilandi","TJ":"Tajikistan","TK":"Tokelau","TM":"Turkmenistan","TL":"Timor-Leste","TO":"Tonga","TT":"I-Trinidad ne Tobago","TN":"ITunisia","TR":"ITheki","TV":"Tuvalu","TW":"I-Tayiwani","TZ":"ITanzania","UG":"IYuganda","UA":"I-Yukreyini","UM":"United States Minor Outlying Islands","UY":"I-Uruguwayi","US":"United States","UZ":"Uzbekistan","VA":"Holy See (Vatican City State)","VC":"Saint Vincent and the Grenadines","VE":"I-Venezuwela","VG":"Virgin Islands, British","VI":"Virgin Islands, U.S.","VN":"IViyetnami","VU":"Vanuatu","WF":"Wallis and Futuna","WS":"Samoa","YE":"IYemen","ZA":"IRiphabliki yaseNingizimu Afrika","ZM":"IZambiya","ZW":"IZimbabwe"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'sixarm_ruby_unaccent'
|
|
2
4
|
|
|
3
5
|
module ISO3166
|
|
4
6
|
UNSEARCHABLE_METHODS = [:translations].freeze
|
|
5
7
|
|
|
6
|
-
def self
|
|
8
|
+
def self.Country(country_data_or_country)
|
|
7
9
|
case country_data_or_country
|
|
8
10
|
when ISO3166::Country
|
|
9
11
|
country_data_or_country
|
|
@@ -15,9 +17,6 @@ module ISO3166
|
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
module CountryClassMethods
|
|
18
|
-
FIND_BY_REGEX = /^find_(all_)?(country_|countries_)?by_(.+)/
|
|
19
|
-
SEARCH_TERM_FILTER_REGEX = /\(|\)|\[\]|,/
|
|
20
|
-
|
|
21
20
|
def new(country_data)
|
|
22
21
|
super if country_data.is_a?(Hash) || codes.include?(country_data.to_s.upcase)
|
|
23
22
|
end
|
|
@@ -33,10 +32,6 @@ module ISO3166
|
|
|
33
32
|
|
|
34
33
|
alias countries all
|
|
35
34
|
|
|
36
|
-
def all_translated(locale = 'en')
|
|
37
|
-
translations(locale).values
|
|
38
|
-
end
|
|
39
|
-
|
|
40
35
|
def all_names_with_codes(locale = 'en')
|
|
41
36
|
Country.all.map do |c|
|
|
42
37
|
lc = (c.translation(locale) || c.iso_short_name)
|
|
@@ -50,6 +45,10 @@ module ISO3166
|
|
|
50
45
|
end
|
|
51
46
|
end
|
|
52
47
|
|
|
48
|
+
def all_translated(locale = 'en')
|
|
49
|
+
translations(locale).values
|
|
50
|
+
end
|
|
51
|
+
|
|
53
52
|
def translations(locale = 'en')
|
|
54
53
|
i18n_data_countries = I18nData.countries(locale.upcase)
|
|
55
54
|
|
|
@@ -62,54 +61,6 @@ module ISO3166
|
|
|
62
61
|
i18n_data_countries.merge(custom_countries)
|
|
63
62
|
end
|
|
64
63
|
|
|
65
|
-
def search(query)
|
|
66
|
-
country = new(query.to_s.upcase)
|
|
67
|
-
country && country.valid? ? country : nil
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def [](query)
|
|
71
|
-
search(query)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def method_missing(method_name, *arguments)
|
|
75
|
-
matches = method_name.to_s.match(FIND_BY_REGEX)
|
|
76
|
-
return_all = matches[1]
|
|
77
|
-
super unless matches
|
|
78
|
-
|
|
79
|
-
if matches[3] == 'names'
|
|
80
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
81
|
-
warn "DEPRECATION WARNING: 'find_by_name' and 'find_*_by_name' methods are deprecated, please refer to the README file for more information on this change.", uplevel: 1, category: :deprecated
|
|
82
|
-
else
|
|
83
|
-
warn "DEPRECATION WARNING: 'find_by_name' and 'find_*_by_name' methods are deprecated, please refer to the README file for more information on this change.", uplevel: 1
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
countries = find_by(matches[3], arguments[0], matches[2])
|
|
88
|
-
return_all ? countries : countries.last
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def respond_to_missing?(method_name, include_private = false)
|
|
92
|
-
matches = method_name.to_s.match(FIND_BY_REGEX)
|
|
93
|
-
if matches && matches[3]
|
|
94
|
-
instance_methods.include?(matches[3].to_sym)
|
|
95
|
-
else
|
|
96
|
-
super
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def find_all_by(attribute, val)
|
|
101
|
-
attributes, lookup_value = parse_attributes(attribute, val)
|
|
102
|
-
|
|
103
|
-
ISO3166::Data.cache.select do |_, v|
|
|
104
|
-
country = Country.new(v)
|
|
105
|
-
attributes.any? do |attr|
|
|
106
|
-
Array(country.send(attr)).any? do |n|
|
|
107
|
-
lookup_value === cached(n) { parse_value(n) }
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
64
|
def subdivisions(alpha2)
|
|
114
65
|
@subdivisions ||= {}
|
|
115
66
|
@subdivisions[alpha2] ||= create_subdivisions(subdivision_data(alpha2))
|
|
@@ -124,51 +75,14 @@ module ISO3166
|
|
|
124
75
|
|
|
125
76
|
protected
|
|
126
77
|
|
|
127
|
-
def strip_accents(
|
|
128
|
-
if
|
|
129
|
-
Regexp.new(
|
|
78
|
+
def strip_accents(string)
|
|
79
|
+
if string.is_a?(Regexp)
|
|
80
|
+
Regexp.new(string.source.unaccent, 'i')
|
|
130
81
|
else
|
|
131
|
-
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def parse_attributes(attribute, val)
|
|
136
|
-
raise "Invalid attribute name '#{attribute}'" unless searchable_attribute?(attribute.to_sym)
|
|
137
|
-
|
|
138
|
-
attributes = Array(attribute.to_s)
|
|
139
|
-
if attribute.to_s == 'name'
|
|
140
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
141
|
-
warn "DEPRECATION WARNING: 'find_by_name' and 'find_*_by_name' methods are deprecated, please refer to the README file for more information on this change.", uplevel: 1, category: :deprecated
|
|
142
|
-
else
|
|
143
|
-
warn "DEPRECATION WARNING: 'find_by_name' and 'find_*_by_name' methods are deprecated, please refer to the README file for more information on this change.", uplevel: 1
|
|
144
|
-
end
|
|
145
|
-
# 'find_by_name' and 'find_*_by_name' will be changed for 5.0
|
|
146
|
-
# The addition of 'iso_short_name' here ensures the behaviour of 4.1 is kept for 4.2
|
|
147
|
-
attributes = %w[iso_short_name unofficial_names translated_names]
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
[attributes, parse_value(val)]
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def searchable_attribute?(attribute)
|
|
154
|
-
searchable_attributes.include?(attribute.to_sym)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def searchable_attributes
|
|
158
|
-
instance_methods - UNSEARCHABLE_METHODS
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def find_by(attribute, value, obj = nil)
|
|
162
|
-
find_all_by(attribute.downcase, value).map do |country|
|
|
163
|
-
obj.nil? ? country : new(country.last)
|
|
82
|
+
string.to_s.unaccent.downcase
|
|
164
83
|
end
|
|
165
84
|
end
|
|
166
85
|
|
|
167
|
-
def parse_value(value)
|
|
168
|
-
value = value.gsub(SEARCH_TERM_FILTER_REGEX, '') if value.respond_to?(:gsub)
|
|
169
|
-
strip_accents(value)
|
|
170
|
-
end
|
|
171
|
-
|
|
172
86
|
def subdivision_data(alpha2)
|
|
173
87
|
file = subdivision_file_path(alpha2)
|
|
174
88
|
File.exist?(file) ? YAML.load_file(file) : {}
|
|
@@ -190,6 +104,7 @@ module ISO3166
|
|
|
190
104
|
def cached(value)
|
|
191
105
|
@_parsed_values_cache ||= {}
|
|
192
106
|
return @_parsed_values_cache[value] if @_parsed_values_cache[value]
|
|
107
|
+
|
|
193
108
|
@_parsed_values_cache[value] = yield
|
|
194
109
|
end
|
|
195
110
|
end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
# encoding: utf-8
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
module ISO3166
|
|
5
4
|
module Emoji
|
|
@@ -36,7 +35,7 @@ module ISO3166
|
|
|
36
35
|
#
|
|
37
36
|
# The emoji flag for this country, using Unicode Regional Indicator characters. e.g: "U+1F1FA U+1F1F8" for 🇺🇸
|
|
38
37
|
def emoji_flag
|
|
39
|
-
alpha2.downcase.chars.map { |c| CODE_POINTS[c] }.join
|
|
38
|
+
alpha2.downcase.chars.map { |c| CODE_POINTS[c] }.join
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ISO3166
|
|
4
|
+
module CountryFinderMethods
|
|
5
|
+
FIND_BY_REGEX = /^find_(all_)?(country_|countries_)?by_(.+)/.freeze
|
|
6
|
+
SEARCH_TERM_FILTER_REGEX = /\(|\)|\[\]|,/.freeze
|
|
7
|
+
|
|
8
|
+
def search(query)
|
|
9
|
+
country = new(query.to_s.upcase)
|
|
10
|
+
country&.valid? ? country : nil
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def [](query)
|
|
14
|
+
search(query)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def find_all_by(attribute, val)
|
|
18
|
+
attributes, lookup_value = parse_attributes(attribute, val)
|
|
19
|
+
|
|
20
|
+
ISO3166::Data.cache.select do |_, v|
|
|
21
|
+
country = Country.new(v)
|
|
22
|
+
attributes.any? do |attr|
|
|
23
|
+
Array(country.send(attr)).any? do |n|
|
|
24
|
+
lookup_value === cached(n) { parse_value(n) }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def method_missing(method_name, *arguments)
|
|
31
|
+
matches = method_name.to_s.match(FIND_BY_REGEX)
|
|
32
|
+
return_all = matches[1]
|
|
33
|
+
super unless matches
|
|
34
|
+
|
|
35
|
+
countries = find_by(matches[3], arguments[0], matches[2])
|
|
36
|
+
return_all ? countries : countries.last
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
40
|
+
matches = method_name.to_s.match(FIND_BY_REGEX)
|
|
41
|
+
if matches && matches[3]
|
|
42
|
+
instance_methods.include?(matches[3].to_sym)
|
|
43
|
+
else
|
|
44
|
+
super
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
protected
|
|
49
|
+
|
|
50
|
+
def find_by(attribute, value, obj = nil)
|
|
51
|
+
find_all_by(attribute.downcase, value).map do |country|
|
|
52
|
+
obj.nil? ? country : new(country.last)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def parse_attributes(attribute, val)
|
|
57
|
+
raise "Invalid attribute name '#{attribute}'" unless searchable_attribute?(attribute.to_sym)
|
|
58
|
+
|
|
59
|
+
attributes = Array(attribute.to_s)
|
|
60
|
+
if attribute.to_s == 'any_name'
|
|
61
|
+
attributes = %w[iso_long_name iso_short_name unofficial_names translated_names]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
[attributes, parse_value(val)]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def parse_value(value)
|
|
68
|
+
value = value.gsub(SEARCH_TERM_FILTER_REGEX, '') if value.respond_to?(:gsub)
|
|
69
|
+
strip_accents(value)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def searchable_attribute?(attribute)
|
|
73
|
+
searchable_attributes.include?(attribute.to_sym)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def searchable_attributes
|
|
77
|
+
# Add name and names until we complete the deprecation of the finders
|
|
78
|
+
instance_methods - UNSEARCHABLE_METHODS + [:name, :names, :any_name]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/lib/countries/country.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ISO3166
|
|
2
4
|
class Country
|
|
3
5
|
extend CountryClassMethods
|
|
6
|
+
extend CountryFinderMethods
|
|
4
7
|
include Emoji
|
|
5
8
|
attr_reader :data
|
|
6
9
|
|
|
@@ -31,24 +34,6 @@ module ISO3166
|
|
|
31
34
|
alias zip_format postal_code_format
|
|
32
35
|
alias languages languages_official
|
|
33
36
|
|
|
34
|
-
def latitude_dec
|
|
35
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
36
|
-
warn "DEPRECATION WARNING: The Country#latitude_dec method has been deprecated and will be removed in 5.0. Please use Country#latitude instead.", uplevel: 1, category: :deprecated
|
|
37
|
-
else
|
|
38
|
-
warn "DEPRECATION WARNING: The Country#latitude_dec method has been deprecated and will be removed in 5.0. Please use Country#latitude instead.", uplevel: 1
|
|
39
|
-
end
|
|
40
|
-
latitude
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def longitude_dec
|
|
44
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
45
|
-
warn "DEPRECATION WARNING: The Country#longitude_dec method has been deprecated and will be removed in 5.0. Please use Country#longitude instead.", uplevel: 1, category: :deprecated
|
|
46
|
-
else
|
|
47
|
-
warn "DEPRECATION WARNING: The Country#longitude_dec method has been deprecated and will be removed in 5.0. Please use Country#longitude instead.", uplevel: 1
|
|
48
|
-
end
|
|
49
|
-
longitude
|
|
50
|
-
end
|
|
51
|
-
|
|
52
37
|
def ==(other)
|
|
53
38
|
other.respond_to?(:alpha2) && other.alpha2 == alpha2
|
|
54
39
|
end
|
|
@@ -136,28 +121,6 @@ module ISO3166
|
|
|
136
121
|
@local_name ||= local_names.first
|
|
137
122
|
end
|
|
138
123
|
|
|
139
|
-
# @return [String] This Country's ISO Short Name
|
|
140
|
-
# @deprecated Use {#iso_short_name} instead.
|
|
141
|
-
def name
|
|
142
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
143
|
-
warn "DEPRECATION WARNING: The Country#name method has been deprecated. Please use Country#iso_short_name instead or refer to the README file for more information on this change.", uplevel: 1, category: :deprecated
|
|
144
|
-
else
|
|
145
|
-
warn "DEPRECATION WARNING: The Country#name method has been deprecated. Please use Country#iso_short_name instead or refer to the README file for more information on this change.", uplevel: 1
|
|
146
|
-
end
|
|
147
|
-
iso_short_name
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
# @return [Array<String>] Array of unofficial, slang names or aliases for this Country
|
|
151
|
-
# @deprecated Use {#unofficial_names} instead.
|
|
152
|
-
def names
|
|
153
|
-
if RUBY_VERSION =~ /^3\.\d\.\d/
|
|
154
|
-
warn "DEPRECATION WARNING: The Country#names method has been deprecated. Please use Country#unofficial_names instead or refer to the README file for more information on this change.", uplevel: 1, category: :deprecated
|
|
155
|
-
else
|
|
156
|
-
warn "DEPRECATION WARNING: The Country#names method has been deprecated. Please use Country#unofficial_names instead or refer to the README file for more information on this change.", uplevel: 1
|
|
157
|
-
end
|
|
158
|
-
unofficial_names
|
|
159
|
-
end
|
|
160
|
-
|
|
161
124
|
# @!attribute alpha2
|
|
162
125
|
# @return [String] the ISO3166 alpha-2 code for this Country
|
|
163
126
|
#
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
'02':
|
|
2
|
+
'02':
|
|
3
3
|
name: Canillo
|
|
4
|
-
code:
|
|
4
|
+
code:
|
|
5
5
|
unofficial_names: Canillo
|
|
6
6
|
geo:
|
|
7
7
|
latitude: 42.5666535
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
max_longitude: 1.6037142
|
|
13
13
|
translations:
|
|
14
14
|
en: Canillo
|
|
15
|
-
comments:
|
|
16
|
-
'03':
|
|
15
|
+
comments:
|
|
16
|
+
'03':
|
|
17
17
|
name: Encamp
|
|
18
|
-
code:
|
|
18
|
+
code:
|
|
19
19
|
unofficial_names: Encamp
|
|
20
20
|
geo:
|
|
21
21
|
latitude: 42.5362652
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
max_longitude: 1.5901645
|
|
27
27
|
translations:
|
|
28
28
|
en: Encamp
|
|
29
|
-
comments:
|
|
30
|
-
'04':
|
|
29
|
+
comments:
|
|
30
|
+
'04':
|
|
31
31
|
name: La Massana
|
|
32
|
-
code:
|
|
32
|
+
code:
|
|
33
33
|
unofficial_names: La Massana
|
|
34
34
|
geo:
|
|
35
35
|
latitude: 42.545625
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
max_longitude: 1.5204314
|
|
41
41
|
translations:
|
|
42
42
|
en: La Massana
|
|
43
|
-
comments:
|
|
44
|
-
'05':
|
|
43
|
+
comments:
|
|
44
|
+
'05':
|
|
45
45
|
name: Ordino
|
|
46
|
-
code:
|
|
46
|
+
code:
|
|
47
47
|
unofficial_names: Ordino
|
|
48
48
|
geo:
|
|
49
49
|
latitude: 42.5556547
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
max_longitude: 1.5374774
|
|
55
55
|
translations:
|
|
56
56
|
en: Ordino
|
|
57
|
-
comments:
|
|
58
|
-
'06':
|
|
57
|
+
comments:
|
|
58
|
+
'06':
|
|
59
59
|
name: Sant Julià de Lòria
|
|
60
|
-
code:
|
|
60
|
+
code:
|
|
61
61
|
unofficial_names:
|
|
62
62
|
- Saint Julia de Loria
|
|
63
63
|
geo:
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
max_longitude: 1.4963642
|
|
70
70
|
translations:
|
|
71
71
|
en: Sant Julià de Lòria
|
|
72
|
-
comments:
|
|
73
|
-
'07':
|
|
72
|
+
comments:
|
|
73
|
+
'07':
|
|
74
74
|
name: Andorra la Vella
|
|
75
|
-
code:
|
|
75
|
+
code:
|
|
76
76
|
unofficial_names:
|
|
77
77
|
- Andorra la Vieja
|
|
78
78
|
- Andorre-la-Vieille
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
max_longitude: 1.5353385
|
|
86
86
|
translations:
|
|
87
87
|
en: Andorra la Vella
|
|
88
|
-
comments:
|
|
89
|
-
'08':
|
|
88
|
+
comments:
|
|
89
|
+
'08':
|
|
90
90
|
name: Escaldes-Engordany
|
|
91
|
-
code:
|
|
91
|
+
code:
|
|
92
92
|
unofficial_names:
|
|
93
93
|
- Les Escaldes
|
|
94
94
|
geo:
|
|
@@ -100,4 +100,4 @@
|
|
|
100
100
|
max_longitude: 1.5532685
|
|
101
101
|
translations:
|
|
102
102
|
en: Escaldes-Engordany
|
|
103
|
-
comments:
|
|
103
|
+
comments:
|
|
@@ -2264,7 +2264,7 @@ ZAB:
|
|
|
2264
2264
|
'no': Zabol
|
|
2265
2265
|
comments:
|
|
2266
2266
|
LOG:
|
|
2267
|
-
name:
|
|
2267
|
+
name: لوګر ولايت
|
|
2268
2268
|
code:
|
|
2269
2269
|
unofficial_names:
|
|
2270
2270
|
geo:
|
|
@@ -2331,7 +2331,7 @@ LOG:
|
|
|
2331
2331
|
'no': Lowgar
|
|
2332
2332
|
comments:
|
|
2333
2333
|
URU:
|
|
2334
|
-
name:
|
|
2334
|
+
name: روزګان ولايت
|
|
2335
2335
|
code:
|
|
2336
2336
|
unofficial_names:
|
|
2337
2337
|
geo:
|