countries 4.2.3 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/tests.yml +3 -7
- data/.rubocop.yml +40 -1
- data/.rubocop_todo.yml +8 -41
- data/CHANGELOG.md +35 -2
- data/Gemfile +5 -3
- data/README.markdown +56 -62
- data/Rakefile +21 -45
- data/UPGRADE.md +39 -0
- data/bin/console +1 -0
- data/countries.gemspec +7 -6
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/ab.json +1 -1
- data/lib/countries/cache/locales/af.json +1 -1
- data/lib/countries/cache/locales/ak.json +1 -1
- data/lib/countries/cache/locales/am.json +1 -1
- data/lib/countries/cache/locales/an.json +1 -1
- data/lib/countries/cache/locales/ar.json +1 -1
- data/lib/countries/cache/locales/as.json +1 -1
- data/lib/countries/cache/locales/ay.json +1 -1
- data/lib/countries/cache/locales/az.json +1 -1
- data/lib/countries/cache/locales/ba.json +1 -1
- data/lib/countries/cache/locales/be.json +1 -1
- data/lib/countries/cache/locales/bg.json +1 -1
- data/lib/countries/cache/locales/bi.json +1 -1
- data/lib/countries/cache/locales/bn-in.json +1 -1
- data/lib/countries/cache/locales/bn.json +1 -1
- data/lib/countries/cache/locales/br.json +1 -1
- data/lib/countries/cache/locales/bs.json +1 -1
- data/lib/countries/cache/locales/ca.json +1 -1
- data/lib/countries/cache/locales/ce.json +1 -1
- data/lib/countries/cache/locales/ch.json +1 -1
- data/lib/countries/cache/locales/cs.json +1 -1
- data/lib/countries/cache/locales/cv.json +1 -1
- data/lib/countries/cache/locales/cy.json +1 -1
- data/lib/countries/cache/locales/da.json +1 -1
- data/lib/countries/cache/locales/de.json +1 -1
- data/lib/countries/cache/locales/dv.json +1 -1
- data/lib/countries/cache/locales/dz.json +1 -1
- data/lib/countries/cache/locales/ee.json +1 -1
- data/lib/countries/cache/locales/el.json +1 -1
- data/lib/countries/cache/locales/en.json +1 -1
- data/lib/countries/cache/locales/eo.json +1 -1
- data/lib/countries/cache/locales/es.json +1 -1
- data/lib/countries/cache/locales/et.json +1 -1
- data/lib/countries/cache/locales/eu.json +1 -1
- data/lib/countries/cache/locales/fa.json +1 -1
- data/lib/countries/cache/locales/ff.json +1 -1
- data/lib/countries/cache/locales/fi.json +1 -1
- data/lib/countries/cache/locales/fo.json +1 -1
- data/lib/countries/cache/locales/fr.json +1 -1
- data/lib/countries/cache/locales/fy.json +1 -1
- data/lib/countries/cache/locales/ga.json +1 -1
- data/lib/countries/cache/locales/gl.json +1 -1
- data/lib/countries/cache/locales/gn.json +1 -1
- data/lib/countries/cache/locales/gu.json +1 -1
- data/lib/countries/cache/locales/gv.json +1 -1
- data/lib/countries/cache/locales/ha.json +1 -1
- data/lib/countries/cache/locales/he.json +1 -1
- data/lib/countries/cache/locales/hi.json +1 -1
- data/lib/countries/cache/locales/hr.json +1 -1
- data/lib/countries/cache/locales/ht.json +1 -1
- data/lib/countries/cache/locales/hu.json +1 -1
- data/lib/countries/cache/locales/hy.json +1 -1
- data/lib/countries/cache/locales/ia.json +1 -1
- data/lib/countries/cache/locales/id.json +1 -1
- data/lib/countries/cache/locales/io.json +1 -1
- data/lib/countries/cache/locales/is.json +1 -1
- data/lib/countries/cache/locales/it.json +1 -1
- data/lib/countries/cache/locales/iu.json +1 -1
- data/lib/countries/cache/locales/ja.json +1 -1
- data/lib/countries/cache/locales/ka.json +1 -1
- data/lib/countries/cache/locales/ki.json +1 -1
- data/lib/countries/cache/locales/kk.json +1 -1
- data/lib/countries/cache/locales/kl.json +1 -1
- data/lib/countries/cache/locales/km.json +1 -1
- data/lib/countries/cache/locales/kn.json +1 -1
- data/lib/countries/cache/locales/ko.json +1 -1
- data/lib/countries/cache/locales/kv.json +1 -1
- data/lib/countries/cache/locales/kw.json +1 -1
- data/lib/countries/cache/locales/ky.json +1 -1
- data/lib/countries/cache/locales/lo.json +1 -1
- data/lib/countries/cache/locales/lt.json +1 -1
- data/lib/countries/cache/locales/lv.json +1 -1
- data/lib/countries/cache/locales/mi.json +1 -1
- data/lib/countries/cache/locales/mk.json +1 -1
- data/lib/countries/cache/locales/ml.json +1 -1
- data/lib/countries/cache/locales/mn.json +1 -1
- data/lib/countries/cache/locales/mr.json +1 -1
- data/lib/countries/cache/locales/ms.json +1 -1
- data/lib/countries/cache/locales/mt.json +1 -1
- data/lib/countries/cache/locales/my.json +1 -1
- data/lib/countries/cache/locales/na.json +1 -1
- data/lib/countries/cache/locales/nb.json +1 -1
- data/lib/countries/cache/locales/ne.json +1 -1
- data/lib/countries/cache/locales/nl.json +1 -1
- data/lib/countries/cache/locales/nn.json +1 -1
- data/lib/countries/cache/locales/nv.json +1 -1
- data/lib/countries/cache/locales/oc.json +1 -1
- data/lib/countries/cache/locales/or.json +1 -1
- data/lib/countries/cache/locales/pa.json +1 -1
- data/lib/countries/cache/locales/pi.json +1 -1
- data/lib/countries/cache/locales/pl.json +1 -1
- data/lib/countries/cache/locales/ps.json +1 -1
- data/lib/countries/cache/locales/pt-br.json +1 -1
- data/lib/countries/cache/locales/pt.json +1 -1
- data/lib/countries/cache/locales/ro.json +1 -1
- data/lib/countries/cache/locales/ru.json +1 -1
- data/lib/countries/cache/locales/rw.json +1 -1
- data/lib/countries/cache/locales/sc.json +1 -1
- data/lib/countries/cache/locales/sd.json +1 -1
- data/lib/countries/cache/locales/si.json +1 -1
- data/lib/countries/cache/locales/sk.json +1 -1
- data/lib/countries/cache/locales/sl.json +1 -1
- data/lib/countries/cache/locales/so.json +1 -1
- data/lib/countries/cache/locales/sq.json +1 -1
- data/lib/countries/cache/locales/sr.json +1 -1
- data/lib/countries/cache/locales/sv.json +1 -1
- data/lib/countries/cache/locales/sw.json +1 -1
- data/lib/countries/cache/locales/ta.json +1 -1
- data/lib/countries/cache/locales/te.json +1 -1
- data/lib/countries/cache/locales/tg.json +1 -1
- data/lib/countries/cache/locales/th.json +1 -1
- data/lib/countries/cache/locales/ti.json +1 -1
- data/lib/countries/cache/locales/tk.json +1 -1
- data/lib/countries/cache/locales/tl.json +1 -1
- data/lib/countries/cache/locales/tr.json +1 -1
- data/lib/countries/cache/locales/tt.json +1 -1
- data/lib/countries/cache/locales/ug.json +1 -1
- data/lib/countries/cache/locales/uk.json +1 -1
- data/lib/countries/cache/locales/ur.json +1 -1
- data/lib/countries/cache/locales/uz.json +1 -1
- data/lib/countries/cache/locales/ve.json +1 -1
- data/lib/countries/cache/locales/vi.json +1 -1
- data/lib/countries/cache/locales/wa.json +1 -1
- data/lib/countries/cache/locales/wo.json +1 -1
- data/lib/countries/cache/locales/xh.json +1 -1
- data/lib/countries/cache/locales/yo.json +1 -1
- data/lib/countries/cache/locales/zh-cn.json +1 -1
- data/lib/countries/cache/locales/zh-hk.json +1 -1
- data/lib/countries/cache/locales/zh-tw.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 +20 -103
- 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 +32 -43
- data/lib/countries/data/countries/KN.yaml +0 -1
- data/lib/countries/data/subdivisions/AD.yaml +14 -7
- data/lib/countries/data/subdivisions/AE.yaml +14 -7
- data/lib/countries/data/subdivisions/AF.yaml +196 -201
- data/lib/countries/data/subdivisions/AG.yaml +16 -22
- data/lib/countries/data/subdivisions/AL.yaml +24 -12
- data/lib/countries/data/subdivisions/AM.yaml +22 -11
- data/lib/countries/data/subdivisions/AO.yaml +36 -18
- data/lib/countries/data/subdivisions/AR.yaml +48 -24
- data/lib/countries/data/subdivisions/AT.yaml +18 -9
- data/lib/countries/data/subdivisions/AU.yaml +16 -8
- data/lib/countries/data/subdivisions/AZ.yaml +434 -412
- data/lib/countries/data/subdivisions/BA.yaml +75 -223
- data/lib/countries/data/subdivisions/BB.yaml +22 -11
- data/lib/countries/data/subdivisions/BD.yaml +188 -116
- data/lib/countries/data/subdivisions/BE.yaml +174 -161
- data/lib/countries/data/subdivisions/BF.yaml +2918 -2860
- data/lib/countries/data/subdivisions/BG.yaml +56 -28
- data/lib/countries/data/subdivisions/BH.yaml +8 -21
- data/lib/countries/data/subdivisions/BI.yaml +176 -157
- data/lib/countries/data/subdivisions/BJ.yaml +24 -12
- data/lib/countries/data/subdivisions/BN.yaml +8 -4
- data/lib/countries/data/subdivisions/BO.yaml +18 -9
- data/lib/countries/data/subdivisions/BQ.yaml +6 -3
- data/lib/countries/data/subdivisions/BR.yaml +54 -27
- data/lib/countries/data/subdivisions/BS.yaml +575 -697
- data/lib/countries/data/subdivisions/BT.yaml +40 -20
- data/lib/countries/data/subdivisions/BW.yaml +337 -321
- data/lib/countries/data/subdivisions/BY.yaml +106 -116
- data/lib/countries/data/subdivisions/BZ.yaml +12 -6
- data/lib/countries/data/subdivisions/CA.yaml +26 -13
- data/lib/countries/data/subdivisions/CD.yaml +488 -525
- data/lib/countries/data/subdivisions/CF.yaml +34 -17
- data/lib/countries/data/subdivisions/CG.yaml +40 -28
- data/lib/countries/data/subdivisions/CH.yaml +52 -26
- data/lib/countries/data/subdivisions/CI.yaml +244 -516
- data/lib/countries/data/subdivisions/CL.yaml +81 -65
- data/lib/countries/data/subdivisions/CM.yaml +20 -10
- data/lib/countries/data/subdivisions/CN.yaml +2152 -2084
- data/lib/countries/data/subdivisions/CO.yaml +66 -33
- data/lib/countries/data/subdivisions/CR.yaml +14 -7
- data/lib/countries/data/subdivisions/CU.yaml +32 -16
- data/lib/countries/data/subdivisions/CV.yaml +427 -401
- data/lib/countries/data/subdivisions/CY.yaml +12 -6
- data/lib/countries/data/subdivisions/CZ.yaml +1116 -85
- data/lib/countries/data/subdivisions/DE.yaml +32 -16
- data/lib/countries/data/subdivisions/DJ.yaml +12 -6
- data/lib/countries/data/subdivisions/DK.yaml +25 -17
- data/lib/countries/data/subdivisions/DM.yaml +20 -10
- data/lib/countries/data/subdivisions/DO.yaml +84 -42
- data/lib/countries/data/subdivisions/DZ.yaml +96 -48
- data/lib/countries/data/subdivisions/EC.yaml +158 -134
- data/lib/countries/data/subdivisions/EE.yaml +501 -334
- data/lib/countries/data/subdivisions/EG.yaml +54 -27
- data/lib/countries/data/subdivisions/ER.yaml +12 -6
- data/lib/countries/data/subdivisions/ES.yaml +1459 -1390
- data/lib/countries/data/subdivisions/ET.yaml +22 -11
- data/lib/countries/data/subdivisions/FI.yaml +185 -1
- data/lib/countries/data/subdivisions/FJ.yaml +443 -424
- data/lib/countries/data/subdivisions/FM.yaml +8 -4
- data/lib/countries/data/subdivisions/FR.yaml +438 -275
- data/lib/countries/data/subdivisions/GA.yaml +18 -9
- data/lib/countries/data/subdivisions/GB.yaml +1185 -1708
- data/lib/countries/data/subdivisions/GD.yaml +14 -7
- data/lib/countries/data/subdivisions/GE.yaml +24 -12
- data/lib/countries/data/subdivisions/GH.yaml +114 -155
- data/lib/countries/data/subdivisions/GL.yaml +24 -79
- data/lib/countries/data/subdivisions/GM.yaml +12 -6
- data/lib/countries/data/subdivisions/GN.yaml +444 -403
- data/lib/countries/data/subdivisions/GQ.yaml +24 -13
- data/lib/countries/data/subdivisions/GR.yaml +114 -73
- data/lib/countries/data/subdivisions/GT.yaml +44 -22
- data/lib/countries/data/subdivisions/GW.yaml +69 -57
- data/lib/countries/data/subdivisions/GY.yaml +20 -10
- data/lib/countries/data/subdivisions/HN.yaml +36 -18
- data/lib/countries/data/subdivisions/HR.yaml +42 -21
- data/lib/countries/data/subdivisions/HT.yaml +73 -63
- data/lib/countries/data/subdivisions/HU.yaml +106 -63
- data/lib/countries/data/subdivisions/ID.yaml +229 -188
- data/lib/countries/data/subdivisions/IE.yaml +128 -97
- data/lib/countries/data/subdivisions/IL.yaml +12 -6
- data/lib/countries/data/subdivisions/IN.yaml +245 -396
- data/lib/countries/data/subdivisions/IQ.yaml +111 -91
- data/lib/countries/data/subdivisions/IR.yaml +1463 -1451
- data/lib/countries/data/subdivisions/IS.yaml +160 -25
- data/lib/countries/data/subdivisions/IT.yaml +8740 -8292
- data/lib/countries/data/subdivisions/JM.yaml +28 -14
- data/lib/countries/data/subdivisions/JO.yaml +24 -12
- data/lib/countries/data/subdivisions/JP.yaml +94 -47
- data/lib/countries/data/subdivisions/KE.yaml +95 -48
- data/lib/countries/data/subdivisions/KG.yaml +95 -86
- data/lib/countries/data/subdivisions/KH.yaml +64 -39
- data/lib/countries/data/subdivisions/KI.yaml +6 -3
- data/lib/countries/data/subdivisions/KM.yaml +6 -3
- data/lib/countries/data/subdivisions/KN.yaml +32 -16
- data/lib/countries/data/subdivisions/KP.yaml +24 -227
- data/lib/countries/data/subdivisions/KR.yaml +34 -17
- data/lib/countries/data/subdivisions/KW.yaml +12 -6
- data/lib/countries/data/subdivisions/KZ.yaml +47 -102
- data/lib/countries/data/subdivisions/LA.yaml +36 -34
- data/lib/countries/data/subdivisions/LB.yaml +71 -63
- data/lib/countries/data/subdivisions/LC.yaml +116 -106
- data/lib/countries/data/subdivisions/LI.yaml +22 -11
- data/lib/countries/data/subdivisions/LK.yaml +445 -411
- data/lib/countries/data/subdivisions/LR.yaml +146 -129
- data/lib/countries/data/subdivisions/LS.yaml +20 -10
- data/lib/countries/data/subdivisions/LT.yaml +1706 -1636
- data/lib/countries/data/subdivisions/LU.yaml +24 -12
- data/lib/countries/data/subdivisions/LV.yaml +1623 -1577
- data/lib/countries/data/subdivisions/LY.yaml +44 -22
- data/lib/countries/data/subdivisions/MA.yaml +810 -1589
- data/lib/countries/data/subdivisions/MC.yaml +261 -244
- data/lib/countries/data/subdivisions/MD.yaml +74 -79
- data/lib/countries/data/subdivisions/ME.yaml +217 -195
- data/lib/countries/data/subdivisions/MG.yaml +12 -6
- data/lib/countries/data/subdivisions/MH.yaml +167 -140
- data/lib/countries/data/subdivisions/MK.yaml +160 -80
- data/lib/countries/data/subdivisions/ML.yaml +48 -37
- data/lib/countries/data/subdivisions/MM.yaml +30 -15
- data/lib/countries/data/subdivisions/MN.yaml +44 -22
- data/lib/countries/data/subdivisions/MR.yaml +30 -34
- data/lib/countries/data/subdivisions/MT.yaml +136 -68
- data/lib/countries/data/subdivisions/MU.yaml +24 -262
- data/lib/countries/data/subdivisions/MV.yaml +161 -254
- data/lib/countries/data/subdivisions/MW.yaml +250 -219
- data/lib/countries/data/subdivisions/MX.yaml +67 -47
- data/lib/countries/data/subdivisions/MY.yaml +32 -16
- data/lib/countries/data/subdivisions/MZ.yaml +22 -11
- data/lib/countries/data/subdivisions/NA.yaml +58 -44
- data/lib/countries/data/subdivisions/NE.yaml +16 -8
- data/lib/countries/data/subdivisions/NG.yaml +74 -37
- data/lib/countries/data/subdivisions/NI.yaml +34 -17
- data/lib/countries/data/subdivisions/NL.yaml +303 -285
- data/lib/countries/data/subdivisions/NO.yaml +39 -17
- data/lib/countries/data/subdivisions/NP.yaml +302 -276
- data/lib/countries/data/subdivisions/NR.yaml +28 -14
- data/lib/countries/data/subdivisions/NZ.yaml +34 -17
- data/lib/countries/data/subdivisions/OM.yaml +260 -311
- data/lib/countries/data/subdivisions/PA.yaml +57 -44
- data/lib/countries/data/subdivisions/PE.yaml +107 -81
- data/lib/countries/data/subdivisions/PG.yaml +163 -158
- data/lib/countries/data/subdivisions/PH.yaml +5062 -4992
- data/lib/countries/data/subdivisions/PK.yaml +145 -235
- data/lib/countries/data/subdivisions/PL.yaml +51 -3
- data/lib/countries/data/subdivisions/PS.yaml +32 -16
- data/lib/countries/data/subdivisions/PT.yaml +53 -33
- data/lib/countries/data/subdivisions/PW.yaml +32 -16
- data/lib/countries/data/subdivisions/PY.yaml +36 -18
- data/lib/countries/data/subdivisions/QA.yaml +27 -78
- data/lib/countries/data/subdivisions/RO.yaml +84 -42
- data/lib/countries/data/subdivisions/RS.yaml +104 -72
- data/lib/countries/data/subdivisions/RU.yaml +166 -83
- data/lib/countries/data/subdivisions/RW.yaml +10 -5
- data/lib/countries/data/subdivisions/SA.yaml +26 -13
- data/lib/countries/data/subdivisions/SB.yaml +20 -10
- data/lib/countries/data/subdivisions/SC.yaml +54 -25
- data/lib/countries/data/subdivisions/SD.yaml +798 -780
- data/lib/countries/data/subdivisions/SE.yaml +42 -21
- data/lib/countries/data/subdivisions/SG.yaml +15 -10
- data/lib/countries/data/subdivisions/SH.yaml +21 -32
- data/lib/countries/data/subdivisions/SI.yaml +475 -263
- data/lib/countries/data/subdivisions/SK.yaml +16 -8
- data/lib/countries/data/subdivisions/SL.yaml +23 -18
- data/lib/countries/data/subdivisions/SM.yaml +18 -9
- data/lib/countries/data/subdivisions/SN.yaml +188 -174
- data/lib/countries/data/subdivisions/SO.yaml +36 -18
- data/lib/countries/data/subdivisions/SR.yaml +20 -10
- data/lib/countries/data/subdivisions/SS.yaml +20 -10
- data/lib/countries/data/subdivisions/ST.yaml +38 -52
- data/lib/countries/data/subdivisions/SV.yaml +28 -14
- data/lib/countries/data/subdivisions/SY.yaml +28 -14
- data/lib/countries/data/subdivisions/SZ.yaml +8 -4
- data/lib/countries/data/subdivisions/TD.yaml +312 -303
- data/lib/countries/data/subdivisions/TG.yaml +10 -5
- data/lib/countries/data/subdivisions/TH.yaml +211 -133
- data/lib/countries/data/subdivisions/TJ.yaml +161 -156
- data/lib/countries/data/subdivisions/TL.yaml +26 -13
- data/lib/countries/data/subdivisions/TM.yaml +12 -6
- data/lib/countries/data/subdivisions/TN.yaml +48 -24
- data/lib/countries/data/subdivisions/TO.yaml +10 -5
- data/lib/countries/data/subdivisions/TR.yaml +162 -81
- data/lib/countries/data/subdivisions/TT.yaml +128 -160
- data/lib/countries/data/subdivisions/TV.yaml +57 -63
- data/lib/countries/data/subdivisions/TW.yaml +143 -183
- data/lib/countries/data/subdivisions/TZ.yaml +62 -31
- data/lib/countries/data/subdivisions/UA.yaml +55 -28
- data/lib/countries/data/subdivisions/UG.yaml +4806 -4660
- data/lib/countries/data/subdivisions/UM.yaml +18 -9
- data/lib/countries/data/subdivisions/US.yaml +114 -57
- data/lib/countries/data/subdivisions/UY.yaml +99 -80
- data/lib/countries/data/subdivisions/UZ.yaml +28 -14
- data/lib/countries/data/subdivisions/VC.yaml +12 -6
- data/lib/countries/data/subdivisions/VE.yaml +50 -25
- data/lib/countries/data/subdivisions/VN.yaml +3576 -3513
- data/lib/countries/data/subdivisions/VU.yaml +12 -6
- data/lib/countries/data/subdivisions/WF.yaml +6 -3
- data/lib/countries/data/subdivisions/WS.yaml +22 -11
- data/lib/countries/data/subdivisions/YE.yaml +222 -200
- data/lib/countries/data/subdivisions/ZA.yaml +86 -100
- data/lib/countries/data/subdivisions/ZM.yaml +20 -10
- data/lib/countries/data/subdivisions/ZW.yaml +20 -10
- data/lib/countries/data/translations/countries-ab.yaml +254 -0
- data/lib/countries/data/translations/countries-af.yaml +254 -0
- data/lib/countries/data/translations/countries-ak.yaml +254 -0
- data/lib/countries/data/translations/countries-am.yaml +254 -0
- data/lib/countries/data/translations/countries-an.yaml +254 -0
- data/lib/countries/data/translations/countries-ar.yaml +254 -0
- data/lib/countries/data/translations/countries-as.yaml +254 -0
- data/lib/countries/data/translations/countries-ay.yaml +254 -0
- data/lib/countries/data/translations/countries-az.yaml +254 -0
- data/lib/countries/data/translations/countries-ba.yaml +254 -0
- data/lib/countries/data/translations/countries-be.yaml +254 -0
- data/lib/countries/data/translations/countries-bg.yaml +254 -0
- data/lib/countries/data/translations/countries-bi.yaml +254 -0
- data/lib/countries/data/translations/countries-bn.yaml +254 -0
- data/lib/countries/data/translations/countries-bn_IN.yaml +254 -0
- data/lib/countries/data/translations/countries-br.yaml +254 -0
- data/lib/countries/data/translations/countries-bs.yaml +254 -0
- data/lib/countries/data/translations/countries-ca.yaml +254 -0
- data/lib/countries/data/translations/countries-ce.yaml +254 -0
- data/lib/countries/data/translations/countries-ch.yaml +254 -0
- data/lib/countries/data/translations/countries-cs.yaml +254 -0
- data/lib/countries/data/translations/countries-cv.yaml +254 -0
- data/lib/countries/data/translations/countries-cy.yaml +254 -0
- data/lib/countries/data/translations/countries-da.yaml +254 -0
- data/lib/countries/data/translations/countries-de.yaml +254 -0
- data/lib/countries/data/translations/countries-dv.yaml +254 -0
- data/lib/countries/data/translations/countries-dz.yaml +254 -0
- data/lib/countries/data/translations/countries-ee.yaml +254 -0
- data/lib/countries/data/translations/countries-el.yaml +254 -0
- data/lib/countries/data/translations/countries-en.yaml +254 -0
- data/lib/countries/data/translations/countries-eo.yaml +254 -0
- data/lib/countries/data/translations/countries-es.yaml +254 -0
- data/lib/countries/data/translations/countries-et.yaml +254 -0
- data/lib/countries/data/translations/countries-eu.yaml +254 -0
- data/lib/countries/data/translations/countries-fa.yaml +254 -0
- data/lib/countries/data/translations/countries-ff.yaml +254 -0
- data/lib/countries/data/translations/countries-fi.yaml +254 -0
- data/lib/countries/data/translations/countries-fo.yaml +254 -0
- data/lib/countries/data/translations/countries-fr.yaml +254 -0
- data/lib/countries/data/translations/countries-fy.yaml +254 -0
- data/lib/countries/data/translations/countries-ga.yaml +254 -0
- data/lib/countries/data/translations/countries-gl.yaml +254 -0
- data/lib/countries/data/translations/countries-gn.yaml +254 -0
- data/lib/countries/data/translations/countries-gu.yaml +254 -0
- data/lib/countries/data/translations/countries-gv.yaml +254 -0
- data/lib/countries/data/translations/countries-ha.yaml +254 -0
- data/lib/countries/data/translations/countries-he.yaml +254 -0
- data/lib/countries/data/translations/countries-hi.yaml +254 -0
- data/lib/countries/data/translations/countries-hr.yaml +254 -0
- data/lib/countries/data/translations/countries-ht.yaml +254 -0
- data/lib/countries/data/translations/countries-hu.yaml +254 -0
- data/lib/countries/data/translations/countries-hy.yaml +254 -0
- data/lib/countries/data/translations/countries-ia.yaml +254 -0
- data/lib/countries/data/translations/countries-id.yaml +254 -0
- data/lib/countries/data/translations/countries-io.yaml +254 -0
- data/lib/countries/data/translations/countries-is.yaml +254 -0
- data/lib/countries/data/translations/countries-it.yaml +254 -0
- data/lib/countries/data/translations/countries-iu.yaml +254 -0
- data/lib/countries/data/translations/countries-ja.yaml +254 -0
- data/lib/countries/data/translations/countries-ka.yaml +254 -0
- data/lib/countries/data/translations/countries-ki.yaml +254 -0
- data/lib/countries/data/translations/countries-kk.yaml +254 -0
- data/lib/countries/data/translations/countries-kl.yaml +254 -0
- data/lib/countries/data/translations/countries-km.yaml +254 -0
- data/lib/countries/data/translations/countries-kn.yaml +254 -0
- data/lib/countries/data/translations/countries-ko.yaml +254 -0
- data/lib/countries/data/translations/countries-ku.yaml +254 -0
- data/lib/countries/data/translations/countries-kv.yaml +254 -0
- data/lib/countries/data/translations/countries-kw.yaml +254 -0
- data/lib/countries/data/translations/countries-ky.yaml +254 -0
- data/lib/countries/data/translations/countries-lo.yaml +254 -0
- data/lib/countries/data/translations/countries-lt.yaml +254 -0
- data/lib/countries/data/translations/countries-lv.yaml +254 -0
- data/lib/countries/data/translations/countries-mi.yaml +254 -0
- data/lib/countries/data/translations/countries-mk.yaml +254 -0
- data/lib/countries/data/translations/countries-ml.yaml +254 -0
- data/lib/countries/data/translations/countries-mn.yaml +254 -0
- data/lib/countries/data/translations/countries-mr.yaml +254 -0
- data/lib/countries/data/translations/countries-ms.yaml +254 -0
- data/lib/countries/data/translations/countries-mt.yaml +254 -0
- data/lib/countries/data/translations/countries-my.yaml +254 -0
- data/lib/countries/data/translations/countries-na.yaml +254 -0
- data/lib/countries/data/translations/countries-nb.yaml +254 -0
- data/lib/countries/data/translations/countries-ne.yaml +254 -0
- data/lib/countries/data/translations/countries-nl.yaml +254 -0
- data/lib/countries/data/translations/countries-nn.yaml +254 -0
- data/lib/countries/data/translations/countries-nv.yaml +254 -0
- data/lib/countries/data/translations/countries-oc.yaml +254 -0
- data/lib/countries/data/translations/countries-or.yaml +254 -0
- data/lib/countries/data/translations/countries-pa.yaml +254 -0
- data/lib/countries/data/translations/countries-pi.yaml +254 -0
- data/lib/countries/data/translations/countries-pl.yaml +254 -0
- data/lib/countries/data/translations/countries-ps.yaml +254 -0
- data/lib/countries/data/translations/countries-pt.yaml +254 -0
- data/lib/countries/data/translations/countries-pt_BR.yaml +254 -0
- data/lib/countries/data/translations/countries-ro.yaml +254 -0
- data/lib/countries/data/translations/countries-ru.yaml +254 -0
- data/lib/countries/data/translations/countries-rw.yaml +254 -0
- data/lib/countries/data/translations/countries-sc.yaml +254 -0
- data/lib/countries/data/translations/countries-sd.yaml +254 -0
- data/lib/countries/data/translations/countries-si.yaml +254 -0
- data/lib/countries/data/translations/countries-sk.yaml +254 -0
- data/lib/countries/data/translations/countries-sl.yaml +254 -0
- data/lib/countries/data/translations/countries-so.yaml +254 -0
- data/lib/countries/data/translations/countries-sq.yaml +254 -0
- data/lib/countries/data/translations/countries-sr.yaml +254 -0
- data/lib/countries/data/translations/countries-sv.yaml +254 -0
- data/lib/countries/data/translations/countries-sw.yaml +254 -0
- data/lib/countries/data/translations/countries-ta.yaml +254 -0
- data/lib/countries/data/translations/countries-te.yaml +254 -0
- data/lib/countries/data/translations/countries-tg.yaml +254 -0
- data/lib/countries/data/translations/countries-th.yaml +254 -0
- data/lib/countries/data/translations/countries-ti.yaml +254 -0
- data/lib/countries/data/translations/countries-tk.yaml +254 -0
- data/lib/countries/data/translations/countries-tl.yaml +254 -0
- data/lib/countries/data/translations/countries-tr.yaml +254 -0
- data/lib/countries/data/translations/countries-tt.yaml +254 -0
- data/lib/countries/data/translations/countries-ug.yaml +254 -0
- data/lib/countries/data/translations/countries-uk.yaml +254 -0
- data/lib/countries/data/translations/countries-ur.yaml +254 -0
- data/lib/countries/data/translations/countries-uz.yaml +254 -0
- data/lib/countries/data/translations/countries-ve.yaml +254 -0
- data/lib/countries/data/translations/countries-vi.yaml +254 -0
- data/lib/countries/data/translations/countries-wa.yaml +254 -0
- data/lib/countries/data/translations/countries-wo.yaml +254 -0
- data/lib/countries/data/translations/countries-xh.yaml +254 -0
- data/lib/countries/data/translations/countries-yo.yaml +254 -0
- data/lib/countries/data/translations/countries-zh_CN.yaml +254 -0
- data/lib/countries/data/translations/countries-zh_HK.yaml +254 -0
- data/lib/countries/data/translations/countries-zh_TW.yaml +254 -0
- data/lib/countries/data/translations/countries-zu.yaml +254 -0
- data/lib/countries/data.rb +45 -42
- data/lib/countries/global.rb +2 -0
- data/lib/countries/iso3166.rb +3 -1
- 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 +21 -8
- 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 +131 -38
- data/spec/data_spec.rb +85 -21
- 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 +146 -34
- data/lib/countries/cache/locales/zh.json +0 -1
- data/lib/countries/data/subdivisions/AI.yaml +0 -197
- data/lib/countries/data/subdivisions/BM.yaml +0 -155
- data/lib/countries/data/subdivisions/CK.yaml +0 -155
- data/lib/countries/data/subdivisions/EH.yaml +0 -80
- data/lib/countries/data/subdivisions/SJ.yaml +0 -29
- data/lib/countries/data/subdivisions/TK.yaml +0 -43
- data/lib/countries/data/translation_corrections.yaml +0 -51
- data/lib/countries/setup.rb +0 -18
data/spec/data_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'spec_helper'
|
3
4
|
require 'benchmark'
|
4
5
|
|
@@ -10,13 +11,13 @@ describe ISO3166::Data do
|
|
10
11
|
|
11
12
|
it 'can load selective locales' do
|
12
13
|
# ISO3166::Data.update_cache
|
13
|
-
ISO3166.configuration.locales = [
|
14
|
+
ISO3166.configuration.locales = %i[es de en]
|
14
15
|
data = ISO3166::Data.new('US').call
|
15
16
|
expect(data['translated_names'].size).to eq 3
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'can load selective locales and reload efficiently' do
|
19
|
-
ISO3166.configuration.locales = [
|
20
|
+
ISO3166.configuration.locales = %i[es de en]
|
20
21
|
data = ISO3166::Data.new('US').call
|
21
22
|
expect(data['translations']).to eq('de' => 'Vereinigte Staaten', 'es' => 'Estados Unidos', 'en' => 'United States')
|
22
23
|
expect(data['translated_names'].sort).to eq ['Vereinigte Staaten', 'Estados Unidos', 'United States'].sort
|
@@ -35,7 +36,7 @@ describe ISO3166::Data do
|
|
35
36
|
|
36
37
|
it 'locales will load prior to return results' do
|
37
38
|
# require 'memory_profiler'
|
38
|
-
ISO3166.configuration.locales = [
|
39
|
+
ISO3166.configuration.locales = %i[es de en]
|
39
40
|
# report = MemoryProfiler.report do
|
40
41
|
ISO3166::Data.update_cache
|
41
42
|
# end
|
@@ -44,7 +45,12 @@ describe ISO3166::Data do
|
|
44
45
|
ISO3166::Data.update_cache
|
45
46
|
|
46
47
|
ISO3166.configure do |config|
|
47
|
-
config.locales = [
|
48
|
+
config.locales = %i[af am ar as az be bg bn br bs ca cs cy da de dz el en
|
49
|
+
eo es et eu fa fi fo fr ga gl gu he hi hr hu hy ia id
|
50
|
+
is it ja ka kk km kn ko ku lt lv mi mk ml mn mr ms mt
|
51
|
+
nb ne nl nn oc or pa pl ps pt ro ru rw si sk sl so sq
|
52
|
+
sr sv sw ta te th ti tk tl tr tt ug uk ve vi wa wo xh
|
53
|
+
zh zu]
|
48
54
|
end
|
49
55
|
# puts Benchmark.measure {ISO3166::Data.update_cache}
|
50
56
|
|
@@ -61,32 +67,32 @@ describe ISO3166::Data do
|
|
61
67
|
|
62
68
|
it 'locales will load prior and be cached' do
|
63
69
|
ISO3166.reset
|
64
|
-
ISO3166.configuration.locales = [
|
65
|
-
expect(ISO3166::Data.send(:locales_to_load)).to eql(%w
|
70
|
+
ISO3166.configuration.locales = %i[es de en]
|
71
|
+
expect(ISO3166::Data.send(:locales_to_load)).to eql(%w[es de en])
|
66
72
|
ISO3166::Data.update_cache
|
67
|
-
ISO3166.configuration.locales = [
|
73
|
+
ISO3166.configuration.locales = %i[es de en]
|
68
74
|
expect(ISO3166::Data.send(:locales_to_load)).to eql([])
|
69
75
|
end
|
70
76
|
|
71
77
|
it 'locales will load prior and be cached' do
|
72
78
|
ISO3166.reset
|
73
|
-
ISO3166.configuration.locales = [
|
79
|
+
ISO3166.configuration.locales = %i[es de en]
|
74
80
|
expect(ISO3166::Data.send(:locales_to_remove)).to eql([])
|
75
81
|
expect(ISO3166::Country.new('DE').translation('de')).to eq 'Deutschland'
|
76
82
|
ISO3166::Data.update_cache
|
77
|
-
ISO3166.configuration.locales = [
|
83
|
+
ISO3166.configuration.locales = %i[es en]
|
78
84
|
expect(ISO3166::Data.send(:locales_to_remove)).to eql(['de'])
|
79
85
|
expect(ISO3166::Country.new('DE').translation('de')).to eq nil
|
80
86
|
end
|
81
87
|
|
82
88
|
describe '#load_cache' do
|
83
89
|
it 'will return an empty hash for an unsupported locale' do
|
84
|
-
file_array = %w
|
90
|
+
file_array = %w[locales unsupported.json]
|
85
91
|
expect(ISO3166::Data.send(:load_cache, file_array)).to eql({})
|
86
92
|
end
|
87
93
|
|
88
94
|
it 'will return json for a supported locale' do
|
89
|
-
file_array = %w
|
95
|
+
file_array = %w[locales en.json]
|
90
96
|
expect(ISO3166::Data.send(:load_cache, file_array)).not_to be_empty
|
91
97
|
end
|
92
98
|
end
|
@@ -97,8 +103,8 @@ describe ISO3166::Data do
|
|
97
103
|
alpha2: 'TW',
|
98
104
|
iso_short_name: 'NEW Taiwan',
|
99
105
|
subdivisions: {
|
100
|
-
CHA: {name: 'New Changhua'},
|
101
|
-
CYI: {name: 'New Municipality'}
|
106
|
+
CHA: { name: 'New Changhua' },
|
107
|
+
CYI: { name: 'New Municipality' }
|
102
108
|
},
|
103
109
|
translations: {
|
104
110
|
'en' => 'NEW Taiwan',
|
@@ -116,8 +122,12 @@ describe ISO3166::Data do
|
|
116
122
|
expect(subject.iso_short_name).to eq 'NEW Taiwan'
|
117
123
|
expect(subject.translations).to eq('en' => 'NEW Taiwan',
|
118
124
|
'de' => 'NEW Taiwan')
|
119
|
-
expect(subject.subdivisions).to eq(
|
120
|
-
|
125
|
+
expect(subject.subdivisions.keys).to eq(%w[CHA CYI])
|
126
|
+
expect(subject.subdivisions.values.map(&:name)).to eq(['New Changhua', 'New Municipality'])
|
127
|
+
end
|
128
|
+
|
129
|
+
after do
|
130
|
+
ISO3166.reset
|
121
131
|
end
|
122
132
|
end
|
123
133
|
|
@@ -127,8 +137,8 @@ describe ISO3166::Data do
|
|
127
137
|
alpha2: 'LOL',
|
128
138
|
iso_short_name: 'Happy Country',
|
129
139
|
subdivisions: {
|
130
|
-
LOL1: {name: 'Happy sub1'},
|
131
|
-
LOL2: {name: 'Happy sub2'}
|
140
|
+
LOL1: { name: 'Happy sub1' },
|
141
|
+
LOL2: { name: 'Happy sub2' }
|
132
142
|
},
|
133
143
|
translations: {
|
134
144
|
'en' => 'Happy Country',
|
@@ -143,8 +153,8 @@ describe ISO3166::Data do
|
|
143
153
|
data = ISO3166::Data.new('LOL').call
|
144
154
|
expect(data['iso_short_name']).to eq 'Happy Country'
|
145
155
|
expect(subject.iso_short_name).to eq 'Happy Country'
|
146
|
-
expect(subject.subdivisions).to eq(
|
147
|
-
|
156
|
+
expect(subject.subdivisions.keys).to eq(%w[LOL1 LOL2])
|
157
|
+
expect(subject.subdivisions.values.map(&:name)).to eq(['Happy sub1', 'Happy sub2'])
|
148
158
|
end
|
149
159
|
|
150
160
|
it 'detect a stale cache' do
|
@@ -175,7 +185,61 @@ describe ISO3166::Data do
|
|
175
185
|
end
|
176
186
|
|
177
187
|
after do
|
178
|
-
ISO3166
|
188
|
+
ISO3166.reset
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe 'data checks' do
|
193
|
+
context 'subdivision YAML files' do
|
194
|
+
it 'has a non-blank code for all subdivisions' do
|
195
|
+
Dir['lib/countries/data/subdivisions/*.yaml'].each do |file|
|
196
|
+
data = YAML.load_file(file)
|
197
|
+
expect(data.values.none?{|s| s['code'].nil? }).to be_truthy, "empty subdivision code in #{file}"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'has a non-blank, lowercase and snake_case type for all subdivisions' do
|
202
|
+
Dir['lib/countries/data/subdivisions/*.yaml'].each do |file|
|
203
|
+
data = YAML.load_file(file)
|
204
|
+
no_type = data.select{|k,v| v['type'].nil? }
|
205
|
+
expect(no_type).to be_empty, "empty subdivision type in #{file} - #{no_type.keys}"
|
206
|
+
uppercase = data.select{|k,v| v['type'] =~ /[A-Z]/ }
|
207
|
+
expect(uppercase).to be_empty, "uppercase characters in subdivision type in #{file} - #{uppercase.keys}"
|
208
|
+
spaces = data.select{|k,v| v['type'] =~ /\s/ }
|
209
|
+
expect(spaces).to be_empty, "whitespace characters in subdivision type in #{file} - #{spaces.keys}"
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'has a non-blank name for all subdivisions' do
|
214
|
+
Dir['lib/countries/data/subdivisions/*.yaml'].each do |file|
|
215
|
+
data = YAML.load_file(file)
|
216
|
+
expect(data.values.none?{|s| s['name'].nil? }).to be_truthy, "empty subdivision name in #{file}"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context 'cached country subdivision data' do
|
222
|
+
it 'has a non-blank code for all subdivisions' do
|
223
|
+
ISO3166::Country.all.each do |country|
|
224
|
+
expect(country.subdivisions.values.none?{|s| s['code'].nil? }).to be_truthy, "empty subdivision code in #{country}"
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'has a non-blank name for all subdivisions' do
|
229
|
+
ISO3166::Country.all.each do |country|
|
230
|
+
expect(country.subdivisions.values.none?{|s| s['name'].nil? }).to be_truthy, "empty subdivision name in #{country}"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'names in Data' do
|
236
|
+
it 'should be unique (to allow .find_by_any_name work properly)' do
|
237
|
+
names = ISO3166::Data.cache.map do |_k, v|
|
238
|
+
[v['iso_short_name'], v['unofficial_names']].flatten.uniq
|
239
|
+
end.flatten
|
240
|
+
|
241
|
+
expect(names.size).to eq(names.uniq.size)
|
242
|
+
end
|
179
243
|
end
|
180
244
|
end
|
181
245
|
end
|
data/spec/mongoid_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
|
-
require File.expand_path('
|
4
|
+
require File.expand_path('../lib/countries/mongoid', __dir__)
|
5
5
|
|
6
6
|
describe 'Mongoid support' do
|
7
7
|
let(:britain) { ISO3166::Country.new('GB') }
|
data/spec/perf_spec.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
#
|
2
|
-
require 'spec_helper'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
3
|
+
require 'spec_helper'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
ALL_LOCALES = %i[
|
6
|
+
af am ar as az be bg bn br bs ca cs cy da de
|
7
|
+
dz el en eo es et eu fa fi fo fr ga gl gu he
|
8
|
+
hi hr hu hy ia id is it ja ka kk km kn ko ku
|
9
|
+
lt lv mi mk ml mn mr ms mt nb ne nl nn oc or
|
10
|
+
pa pl ps pt ro ru rw si sk sl so sq sr sv sw
|
11
|
+
ta te th ti tk tl tr tt ug uk ve vi wa wo xh
|
12
|
+
zh zu
|
13
|
+
].freeze
|
15
14
|
|
15
|
+
describe ISO3166::Data, perf: true, order: :defined do
|
16
16
|
def perf_report(_name)
|
17
17
|
require 'benchmark'
|
18
18
|
require 'memory_profiler'
|
@@ -28,7 +28,7 @@ describe ISO3166::Data, perf: true, order: :defined do
|
|
28
28
|
|
29
29
|
# print a flat profile to text
|
30
30
|
printer = RubyProf::FlatPrinter.new(result)
|
31
|
-
printer.print(
|
31
|
+
printer.print($stdout)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'responds to call' do
|
@@ -40,12 +40,12 @@ describe ISO3166::Data, perf: true, order: :defined do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'locales will load prior to return results' do
|
43
|
-
ISO3166.configuration.locales = [
|
43
|
+
ISO3166.configuration.locales = %i[es de en]
|
44
44
|
report = MemoryProfiler.report do
|
45
45
|
ISO3166::Data.update_cache
|
46
46
|
end
|
47
47
|
|
48
|
-
report.pretty_print(to_file: 'tmp/
|
48
|
+
report.pretty_print(to_file: 'tmp/3_locales.txt')
|
49
49
|
puts Benchmark.measure { ISO3166::Data.update_cache }
|
50
50
|
|
51
51
|
ISO3166.configure do |config|
|
@@ -57,7 +57,7 @@ describe ISO3166::Data, perf: true, order: :defined do
|
|
57
57
|
ISO3166::Data.update_cache
|
58
58
|
end
|
59
59
|
|
60
|
-
report.pretty_print(to_file: 'tmp/
|
60
|
+
report.pretty_print(to_file: 'tmp/all_locales.txt')
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'loades a specfic country quickly' do
|
data/spec/spec_helper.rb
CHANGED
data/spec/subdivision_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
@@ -23,9 +23,11 @@ describe ISO3166::Subdivision do
|
|
23
23
|
describe 'state codes' do
|
24
24
|
it 'should all be strings' do
|
25
25
|
countries.each do |country|
|
26
|
-
expect(country.subdivisions.keys).to
|
27
|
-
|
28
|
-
"
|
26
|
+
expect(country.subdivisions.keys).to(
|
27
|
+
all(be_a(String)),
|
28
|
+
"Expected #{country.alpha2.inspect} to have string subdivision \
|
29
|
+
codes but had #{country.subdivisions.keys.inspect}"
|
30
|
+
)
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
data/spec/thread_safety_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
describe 'Accessing ISO3166::Country instances data in multiple threads' do
|
2
4
|
before do
|
3
5
|
if Thread.respond_to?(:report_on_exception)
|
@@ -12,7 +14,7 @@ describe 'Accessing ISO3166::Country instances data in multiple threads' do
|
|
12
14
|
nthreads = 100
|
13
15
|
threads = []
|
14
16
|
|
15
|
-
alpha2_codes = [
|
17
|
+
alpha2_codes = %w[us es nl ca de fr mx ru ch jp]
|
16
18
|
|
17
19
|
nthreads.times do
|
18
20
|
threads << Thread.new do
|
@@ -31,7 +33,7 @@ describe 'Accessing ISO3166::Country instances data in multiple threads' do
|
|
31
33
|
expect { create_countries_threaded }.to_not raise_error
|
32
34
|
end
|
33
35
|
|
34
|
-
it
|
36
|
+
it 'raises NoMethodError when not using a mutex' do
|
35
37
|
allow(ISO3166::Data).to receive(:use_mutex?).and_return(false)
|
36
38
|
|
37
39
|
expect { create_countries_threaded }.to raise_error(NoMethodError)
|
@@ -43,4 +45,3 @@ describe 'Accessing ISO3166::Country instances data in multiple threads' do
|
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
|
-
|
data/spec/timezone_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Robinson
|
@@ -11,22 +11,8 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name: i18n_data
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - "~>"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.16.0
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.16.0
|
30
16
|
- !ruby/object:Gem::Dependency
|
31
17
|
name: sixarm_ruby_unaccent
|
32
18
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,7 +28,7 @@ dependencies:
|
|
42
28
|
- !ruby/object:Gem::Version
|
43
29
|
version: '1.1'
|
44
30
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
31
|
+
name: activesupport
|
46
32
|
requirement: !ruby/object:Gem::Requirement
|
47
33
|
requirements:
|
48
34
|
- - ">="
|
@@ -56,33 +42,33 @@ dependencies:
|
|
56
42
|
- !ruby/object:Gem::Version
|
57
43
|
version: '3'
|
58
44
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
45
|
+
name: nokogiri
|
60
46
|
requirement: !ruby/object:Gem::Requirement
|
61
47
|
requirements:
|
62
48
|
- - ">="
|
63
49
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
50
|
+
version: '1.8'
|
65
51
|
type: :development
|
66
52
|
prerelease: false
|
67
53
|
version_requirements: !ruby/object:Gem::Requirement
|
68
54
|
requirements:
|
69
55
|
- - ">="
|
70
56
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
57
|
+
version: '1.8'
|
72
58
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
59
|
+
name: rspec
|
74
60
|
requirement: !ruby/object:Gem::Requirement
|
75
61
|
requirements:
|
76
62
|
- - ">="
|
77
63
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
64
|
+
version: '3'
|
79
65
|
type: :development
|
80
66
|
prerelease: false
|
81
67
|
version_requirements: !ruby/object:Gem::Requirement
|
82
68
|
requirements:
|
83
69
|
- - ">="
|
84
70
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
71
|
+
version: '3'
|
86
72
|
description: All sorts of useful information about every country packaged as pretty
|
87
73
|
little country objects. It includes data from ISO 3166
|
88
74
|
email:
|
@@ -93,6 +79,7 @@ executables: []
|
|
93
79
|
extensions: []
|
94
80
|
extra_rdoc_files: []
|
95
81
|
files:
|
82
|
+
- ".github/workflows/codeql-analysis.yml"
|
96
83
|
- ".github/workflows/tests.yml"
|
97
84
|
- ".gitignore"
|
98
85
|
- ".rspec"
|
@@ -103,6 +90,7 @@ files:
|
|
103
90
|
- LICENSE
|
104
91
|
- README.markdown
|
105
92
|
- Rakefile
|
93
|
+
- UPGRADE.md
|
106
94
|
- bin/console
|
107
95
|
- countries.gemspec
|
108
96
|
- lib/countries.rb
|
@@ -237,13 +225,13 @@ files:
|
|
237
225
|
- lib/countries/cache/locales/zh-cn.json
|
238
226
|
- lib/countries/cache/locales/zh-hk.json
|
239
227
|
- lib/countries/cache/locales/zh-tw.json
|
240
|
-
- lib/countries/cache/locales/zh.json
|
241
228
|
- lib/countries/cache/locales/zu.json
|
242
229
|
- lib/countries/configuration.rb
|
243
230
|
- lib/countries/country.rb
|
244
231
|
- lib/countries/country/class_methods.rb
|
245
232
|
- lib/countries/country/currency_methods.rb
|
246
233
|
- lib/countries/country/emoji.rb
|
234
|
+
- lib/countries/country/finder_methods.rb
|
247
235
|
- lib/countries/data.rb
|
248
236
|
- lib/countries/data/countries/AD.yaml
|
249
237
|
- lib/countries/data/countries/AE.yaml
|
@@ -498,7 +486,6 @@ files:
|
|
498
486
|
- lib/countries/data/subdivisions/AE.yaml
|
499
487
|
- lib/countries/data/subdivisions/AF.yaml
|
500
488
|
- lib/countries/data/subdivisions/AG.yaml
|
501
|
-
- lib/countries/data/subdivisions/AI.yaml
|
502
489
|
- lib/countries/data/subdivisions/AL.yaml
|
503
490
|
- lib/countries/data/subdivisions/AM.yaml
|
504
491
|
- lib/countries/data/subdivisions/AO.yaml
|
@@ -515,7 +502,6 @@ files:
|
|
515
502
|
- lib/countries/data/subdivisions/BH.yaml
|
516
503
|
- lib/countries/data/subdivisions/BI.yaml
|
517
504
|
- lib/countries/data/subdivisions/BJ.yaml
|
518
|
-
- lib/countries/data/subdivisions/BM.yaml
|
519
505
|
- lib/countries/data/subdivisions/BN.yaml
|
520
506
|
- lib/countries/data/subdivisions/BO.yaml
|
521
507
|
- lib/countries/data/subdivisions/BQ.yaml
|
@@ -531,7 +517,6 @@ files:
|
|
531
517
|
- lib/countries/data/subdivisions/CG.yaml
|
532
518
|
- lib/countries/data/subdivisions/CH.yaml
|
533
519
|
- lib/countries/data/subdivisions/CI.yaml
|
534
|
-
- lib/countries/data/subdivisions/CK.yaml
|
535
520
|
- lib/countries/data/subdivisions/CL.yaml
|
536
521
|
- lib/countries/data/subdivisions/CM.yaml
|
537
522
|
- lib/countries/data/subdivisions/CN.yaml
|
@@ -550,7 +535,6 @@ files:
|
|
550
535
|
- lib/countries/data/subdivisions/EC.yaml
|
551
536
|
- lib/countries/data/subdivisions/EE.yaml
|
552
537
|
- lib/countries/data/subdivisions/EG.yaml
|
553
|
-
- lib/countries/data/subdivisions/EH.yaml
|
554
538
|
- lib/countries/data/subdivisions/ER.yaml
|
555
539
|
- lib/countries/data/subdivisions/ES.yaml
|
556
540
|
- lib/countries/data/subdivisions/ET.yaml
|
@@ -658,7 +642,6 @@ files:
|
|
658
642
|
- lib/countries/data/subdivisions/SG.yaml
|
659
643
|
- lib/countries/data/subdivisions/SH.yaml
|
660
644
|
- lib/countries/data/subdivisions/SI.yaml
|
661
|
-
- lib/countries/data/subdivisions/SJ.yaml
|
662
645
|
- lib/countries/data/subdivisions/SK.yaml
|
663
646
|
- lib/countries/data/subdivisions/SL.yaml
|
664
647
|
- lib/countries/data/subdivisions/SM.yaml
|
@@ -674,7 +657,6 @@ files:
|
|
674
657
|
- lib/countries/data/subdivisions/TG.yaml
|
675
658
|
- lib/countries/data/subdivisions/TH.yaml
|
676
659
|
- lib/countries/data/subdivisions/TJ.yaml
|
677
|
-
- lib/countries/data/subdivisions/TK.yaml
|
678
660
|
- lib/countries/data/subdivisions/TL.yaml
|
679
661
|
- lib/countries/data/subdivisions/TM.yaml
|
680
662
|
- lib/countries/data/subdivisions/TN.yaml
|
@@ -700,12 +682,141 @@ files:
|
|
700
682
|
- lib/countries/data/subdivisions/ZA.yaml
|
701
683
|
- lib/countries/data/subdivisions/ZM.yaml
|
702
684
|
- lib/countries/data/subdivisions/ZW.yaml
|
703
|
-
- lib/countries/data/
|
685
|
+
- lib/countries/data/translations/countries-ab.yaml
|
686
|
+
- lib/countries/data/translations/countries-af.yaml
|
687
|
+
- lib/countries/data/translations/countries-ak.yaml
|
688
|
+
- lib/countries/data/translations/countries-am.yaml
|
689
|
+
- lib/countries/data/translations/countries-an.yaml
|
690
|
+
- lib/countries/data/translations/countries-ar.yaml
|
691
|
+
- lib/countries/data/translations/countries-as.yaml
|
692
|
+
- lib/countries/data/translations/countries-ay.yaml
|
693
|
+
- lib/countries/data/translations/countries-az.yaml
|
694
|
+
- lib/countries/data/translations/countries-ba.yaml
|
695
|
+
- lib/countries/data/translations/countries-be.yaml
|
696
|
+
- lib/countries/data/translations/countries-bg.yaml
|
697
|
+
- lib/countries/data/translations/countries-bi.yaml
|
698
|
+
- lib/countries/data/translations/countries-bn.yaml
|
699
|
+
- lib/countries/data/translations/countries-bn_IN.yaml
|
700
|
+
- lib/countries/data/translations/countries-br.yaml
|
701
|
+
- lib/countries/data/translations/countries-bs.yaml
|
702
|
+
- lib/countries/data/translations/countries-ca.yaml
|
703
|
+
- lib/countries/data/translations/countries-ce.yaml
|
704
|
+
- lib/countries/data/translations/countries-ch.yaml
|
705
|
+
- lib/countries/data/translations/countries-cs.yaml
|
706
|
+
- lib/countries/data/translations/countries-cv.yaml
|
707
|
+
- lib/countries/data/translations/countries-cy.yaml
|
708
|
+
- lib/countries/data/translations/countries-da.yaml
|
709
|
+
- lib/countries/data/translations/countries-de.yaml
|
710
|
+
- lib/countries/data/translations/countries-dv.yaml
|
711
|
+
- lib/countries/data/translations/countries-dz.yaml
|
712
|
+
- lib/countries/data/translations/countries-ee.yaml
|
713
|
+
- lib/countries/data/translations/countries-el.yaml
|
714
|
+
- lib/countries/data/translations/countries-en.yaml
|
715
|
+
- lib/countries/data/translations/countries-eo.yaml
|
716
|
+
- lib/countries/data/translations/countries-es.yaml
|
717
|
+
- lib/countries/data/translations/countries-et.yaml
|
718
|
+
- lib/countries/data/translations/countries-eu.yaml
|
719
|
+
- lib/countries/data/translations/countries-fa.yaml
|
720
|
+
- lib/countries/data/translations/countries-ff.yaml
|
721
|
+
- lib/countries/data/translations/countries-fi.yaml
|
722
|
+
- lib/countries/data/translations/countries-fo.yaml
|
723
|
+
- lib/countries/data/translations/countries-fr.yaml
|
724
|
+
- lib/countries/data/translations/countries-fy.yaml
|
725
|
+
- lib/countries/data/translations/countries-ga.yaml
|
726
|
+
- lib/countries/data/translations/countries-gl.yaml
|
727
|
+
- lib/countries/data/translations/countries-gn.yaml
|
728
|
+
- lib/countries/data/translations/countries-gu.yaml
|
729
|
+
- lib/countries/data/translations/countries-gv.yaml
|
730
|
+
- lib/countries/data/translations/countries-ha.yaml
|
731
|
+
- lib/countries/data/translations/countries-he.yaml
|
732
|
+
- lib/countries/data/translations/countries-hi.yaml
|
733
|
+
- lib/countries/data/translations/countries-hr.yaml
|
734
|
+
- lib/countries/data/translations/countries-ht.yaml
|
735
|
+
- lib/countries/data/translations/countries-hu.yaml
|
736
|
+
- lib/countries/data/translations/countries-hy.yaml
|
737
|
+
- lib/countries/data/translations/countries-ia.yaml
|
738
|
+
- lib/countries/data/translations/countries-id.yaml
|
739
|
+
- lib/countries/data/translations/countries-io.yaml
|
740
|
+
- lib/countries/data/translations/countries-is.yaml
|
741
|
+
- lib/countries/data/translations/countries-it.yaml
|
742
|
+
- lib/countries/data/translations/countries-iu.yaml
|
743
|
+
- lib/countries/data/translations/countries-ja.yaml
|
744
|
+
- lib/countries/data/translations/countries-ka.yaml
|
745
|
+
- lib/countries/data/translations/countries-ki.yaml
|
746
|
+
- lib/countries/data/translations/countries-kk.yaml
|
747
|
+
- lib/countries/data/translations/countries-kl.yaml
|
748
|
+
- lib/countries/data/translations/countries-km.yaml
|
749
|
+
- lib/countries/data/translations/countries-kn.yaml
|
750
|
+
- lib/countries/data/translations/countries-ko.yaml
|
751
|
+
- lib/countries/data/translations/countries-ku.yaml
|
752
|
+
- lib/countries/data/translations/countries-kv.yaml
|
753
|
+
- lib/countries/data/translations/countries-kw.yaml
|
754
|
+
- lib/countries/data/translations/countries-ky.yaml
|
755
|
+
- lib/countries/data/translations/countries-lo.yaml
|
756
|
+
- lib/countries/data/translations/countries-lt.yaml
|
757
|
+
- lib/countries/data/translations/countries-lv.yaml
|
758
|
+
- lib/countries/data/translations/countries-mi.yaml
|
759
|
+
- lib/countries/data/translations/countries-mk.yaml
|
760
|
+
- lib/countries/data/translations/countries-ml.yaml
|
761
|
+
- lib/countries/data/translations/countries-mn.yaml
|
762
|
+
- lib/countries/data/translations/countries-mr.yaml
|
763
|
+
- lib/countries/data/translations/countries-ms.yaml
|
764
|
+
- lib/countries/data/translations/countries-mt.yaml
|
765
|
+
- lib/countries/data/translations/countries-my.yaml
|
766
|
+
- lib/countries/data/translations/countries-na.yaml
|
767
|
+
- lib/countries/data/translations/countries-nb.yaml
|
768
|
+
- lib/countries/data/translations/countries-ne.yaml
|
769
|
+
- lib/countries/data/translations/countries-nl.yaml
|
770
|
+
- lib/countries/data/translations/countries-nn.yaml
|
771
|
+
- lib/countries/data/translations/countries-nv.yaml
|
772
|
+
- lib/countries/data/translations/countries-oc.yaml
|
773
|
+
- lib/countries/data/translations/countries-or.yaml
|
774
|
+
- lib/countries/data/translations/countries-pa.yaml
|
775
|
+
- lib/countries/data/translations/countries-pi.yaml
|
776
|
+
- lib/countries/data/translations/countries-pl.yaml
|
777
|
+
- lib/countries/data/translations/countries-ps.yaml
|
778
|
+
- lib/countries/data/translations/countries-pt.yaml
|
779
|
+
- lib/countries/data/translations/countries-pt_BR.yaml
|
780
|
+
- lib/countries/data/translations/countries-ro.yaml
|
781
|
+
- lib/countries/data/translations/countries-ru.yaml
|
782
|
+
- lib/countries/data/translations/countries-rw.yaml
|
783
|
+
- lib/countries/data/translations/countries-sc.yaml
|
784
|
+
- lib/countries/data/translations/countries-sd.yaml
|
785
|
+
- lib/countries/data/translations/countries-si.yaml
|
786
|
+
- lib/countries/data/translations/countries-sk.yaml
|
787
|
+
- lib/countries/data/translations/countries-sl.yaml
|
788
|
+
- lib/countries/data/translations/countries-so.yaml
|
789
|
+
- lib/countries/data/translations/countries-sq.yaml
|
790
|
+
- lib/countries/data/translations/countries-sr.yaml
|
791
|
+
- lib/countries/data/translations/countries-sv.yaml
|
792
|
+
- lib/countries/data/translations/countries-sw.yaml
|
793
|
+
- lib/countries/data/translations/countries-ta.yaml
|
794
|
+
- lib/countries/data/translations/countries-te.yaml
|
795
|
+
- lib/countries/data/translations/countries-tg.yaml
|
796
|
+
- lib/countries/data/translations/countries-th.yaml
|
797
|
+
- lib/countries/data/translations/countries-ti.yaml
|
798
|
+
- lib/countries/data/translations/countries-tk.yaml
|
799
|
+
- lib/countries/data/translations/countries-tl.yaml
|
800
|
+
- lib/countries/data/translations/countries-tr.yaml
|
801
|
+
- lib/countries/data/translations/countries-tt.yaml
|
802
|
+
- lib/countries/data/translations/countries-ug.yaml
|
803
|
+
- lib/countries/data/translations/countries-uk.yaml
|
804
|
+
- lib/countries/data/translations/countries-ur.yaml
|
805
|
+
- lib/countries/data/translations/countries-uz.yaml
|
806
|
+
- lib/countries/data/translations/countries-ve.yaml
|
807
|
+
- lib/countries/data/translations/countries-vi.yaml
|
808
|
+
- lib/countries/data/translations/countries-wa.yaml
|
809
|
+
- lib/countries/data/translations/countries-wo.yaml
|
810
|
+
- lib/countries/data/translations/countries-xh.yaml
|
811
|
+
- lib/countries/data/translations/countries-yo.yaml
|
812
|
+
- lib/countries/data/translations/countries-zh_CN.yaml
|
813
|
+
- lib/countries/data/translations/countries-zh_HK.yaml
|
814
|
+
- lib/countries/data/translations/countries-zh_TW.yaml
|
815
|
+
- lib/countries/data/translations/countries-zu.yaml
|
704
816
|
- lib/countries/global.rb
|
705
817
|
- lib/countries/iso3166.rb
|
706
818
|
- lib/countries/kwarg_struct.rb
|
707
819
|
- lib/countries/mongoid.rb
|
708
|
-
- lib/countries/setup.rb
|
709
820
|
- lib/countries/sources.rb
|
710
821
|
- lib/countries/sources/cldr/downloader.rb
|
711
822
|
- lib/countries/sources/cldr/subdivision.rb
|
@@ -737,6 +848,7 @@ metadata:
|
|
737
848
|
changelog_uri: https://github.com/countries/countries/blob/master/CHANGELOG.md
|
738
849
|
source_code_uri: https://github.com/countries/countries
|
739
850
|
wiki_uri: https://github.com/countries/countries/wiki
|
851
|
+
rubygems_mfa_required: 'true'
|
740
852
|
post_install_message:
|
741
853
|
rdoc_options: []
|
742
854
|
require_paths:
|
@@ -745,14 +857,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
745
857
|
requirements:
|
746
858
|
- - ">="
|
747
859
|
- !ruby/object:Gem::Version
|
748
|
-
version: '2.
|
860
|
+
version: '2.7'
|
749
861
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
750
862
|
requirements:
|
751
863
|
- - ">="
|
752
864
|
- !ruby/object:Gem::Version
|
753
865
|
version: '0'
|
754
866
|
requirements: []
|
755
|
-
rubygems_version: 3.3.
|
867
|
+
rubygems_version: 3.3.7
|
756
868
|
signing_key:
|
757
869
|
specification_version: 4
|
758
870
|
summary: Gives you a country object full of all sorts of useful information.
|