fifa 2024.9.22 → 2024.10.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3bf43bacb89e178a5c836edc7b9654ae23e8ddc440e8ce2fd215295387d7f8b
4
- data.tar.gz: 3dc3ee724c145640ddc5ba6a992cb751a290e38bdb78f6abcd0fa3c52fb4dbbd
3
+ metadata.gz: 867568e754139dd434ceada10ec464a3b171070d081f008819f7acfd0a90b02d
4
+ data.tar.gz: 249272b08c1b55e8ceebfd844f768e95eedc20e4b1087409b04bf4b9a2e18124
5
5
  SHA512:
6
- metadata.gz: 30e3ec97c2d6b12edd84be1345d1acd90e3c7da87390296110dd51df502432811e57a6f2e4e6d8e672f736ab2eee7765fa09bd86e8a54105ca313e56732e91bb
7
- data.tar.gz: 21cbba46ec38f6f94bcdcceaad86d86c060f8ff3afacf838032ffb0c636411b882be579eced74e8ed95d41483c27b3600040b3a30ec94330b85920c959602b57
6
+ metadata.gz: 8b7422f0a10e4aa40b15a5621fbcd936803f54ffd0735aed2d477036a08a2c1e5563eb0590e55fea6f7490b2e545a73e18e5073b3365b2f764bb2d7e365a331c
7
+ data.tar.gz: 740e883c235a56d3b8b137dd89eda13f1dc642d87e7eba34ac08d6373d38a86b1e99f0ed5fda024f045fcd4aebb77e612412337a0d483001962318ebcd79b250
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 2024.9.22
1
+ ### 2024.10.5
2
2
 
3
3
  ### 0.0.1 / 2019-08-12
4
4
 
data/README.md CHANGED
@@ -128,7 +128,7 @@ That's it.
128
128
  The World's Football Association / Governing Body
129
129
  uses its own country list and (three-letter²) codes - see
130
130
  the [List of FIFA country codes @ Wikipedia](https://en.wikipedia.org/wiki/List_of_FIFA_country_codes)
131
- or the [built-in country datafiles (in .txt)](https://github.com/sportdb/football.db/blob/master/fifa/config) shipping with this library.
131
+ or the [built-in country datafiles (in .txt)](https://github.com/sportdb/fifa/blob/master/config) shipping with this library.
132
132
 
133
133
 
134
134
 
data/Rakefile CHANGED
@@ -21,6 +21,7 @@ Hoe.spec 'fifa' do
21
21
 
22
22
  self.extra_deps = [
23
23
  ['sportdb-structs', '>= 0.4.0'],
24
+ ['alphabets'],
24
25
  ]
25
26
 
26
27
  self.spec_extras = {
@@ -6,52 +6,76 @@ bi Burundi, BDI, fifa › caf › cecafa
6
6
  dj Djibouti, DJI, fifa › caf › cecafa
7
7
  er Eritrea, ERI, fifa › caf › cecafa
8
8
  et Ethiopia, ETH, fifa › caf › cecafa
9
+ | Äthiopien [de]
9
10
  ke Kenya, KEN, fifa › caf › cecafa
11
+ | Kenia [de]
10
12
  rw Rwanda, RWA, fifa › caf › cecafa
13
+ | Ruanda [de]
11
14
  so Somalia, SOM, fifa › caf › cecafa
12
15
  tz Tanzania, TAN, fifa › caf › cecafa
16
+ | Tansania [de]
13
17
  ug Uganda, UGA, fifa › caf › cecafa
14
18
 
15
19
  km Comoros, COM, fifa › caf › cosafa
20
+ | Komoren [de]
16
21
  mg Madagascar, MAD, fifa › caf › cosafa
22
+ | Madagaskar [de]
17
23
  mw Malawi, MWI, fifa › caf › cosafa
18
24
  mu Mauritius, MRI, fifa › caf › cosafa
19
25
  mz Mozambique, MOZ, fifa › caf › cosafa
26
+ | Mosambik [de]
20
27
  sc Seychelles, SEY, fifa › caf › cosafa
28
+ | Seychellen [de]
21
29
  zm Zambia, ZAM, fifa › caf › cosafa
30
+ | Sambia [de]
22
31
  zw Zimbabwe, ZIM, fifa › caf › cosafa
32
+ | Simbabwe [de]
23
33
 
24
34
 
25
35
  ### Central Africa
26
36
  ao Angola, ANG, fifa › caf › cosafa
27
37
  cm Cameroon, CMR, fifa › caf › uniffac
38
+ | Kamerun [de]
28
39
  cf Central African Republic, CTA, fifa › caf › uniffac
29
40
  | C. Afr. Rep.
41
+ | Zentralafr. Republik [de]
30
42
  td Chad, CHA, fifa › caf › uniffac
43
+ | Tschad [de]
31
44
  cg Congo, CGO, fifa › caf › uniffac
32
45
  | Congo-Brazzaville | Congo-Brazz.
46
+ | Kongo [de]
33
47
  cd Congo DR, COD, fifa › caf › uniffac ## use "Congo, DR"
34
48
  | DR Congo | Democratic Republic of the Congo
35
49
  | Congo-Kinshasa | Congo-Kinsh.
50
+ | DR Kongo [de]
36
51
  gq Equatorial Guinea, EQG, fifa › caf › uniffac
37
52
  | Equat. Guinea
53
+ | Äquatorialguinea [de]
38
54
  ga Gabon, GAB, fifa › caf › uniffac
55
+ | Gabun
39
56
  st São Tomé and Príncipe, STP, fifa › caf › uniffac
40
57
  | São Tomé e Príncipe | São Tomé/Pr.
41
58
 
42
59
 
43
60
  ### Northern Africa
44
61
  dz Algeria, ALG, fifa › caf › unaf
62
+ | Algerien [de]
45
63
  eg Egypt, EGY, fifa › caf › unaf
64
+ | Ägypten [de]
46
65
  ma Morocco, MAR, fifa › caf › unaf
66
+ | Marokko [de]
47
67
  ly Libya, LBY, fifa › caf › unaf
68
+ | Libyen [de]
48
69
  tn Tunisia, TUN, fifa › caf › unaf
70
+ | Tunesien [de]
49
71
  ss South Sudan, SSD, fifa › caf › cecafa
72
+ | Südsudan [de]
50
73
  sd Sudan, SDN, fifa › caf › cecafa
51
74
 
52
75
 
53
76
  ### Southern Africa
54
77
  za South Africa, RSA, fifa › caf › cosafa
78
+ | Südafrika [de]
55
79
  bw Botswana, BOT, fifa › caf › cosafa
56
80
  ls Lesotho, LES, fifa › caf › cosafa
57
81
  na Namibia, NAM, fifa › caf › cosafa
@@ -66,6 +90,7 @@ cv Cabo Verde, CPV, fifa › caf › wafu
66
90
  | Cape Verde | Cape Verde Islands
67
91
  ci Côte d'Ivoire, CIV, fifa › caf › wafu
68
92
  | Ivory Coast [en]
93
+ | Elfenbeinküste [de]
69
94
  gm Gambia, GAM, fifa › caf › wafu
70
95
  gh Ghana, GHA, fifa › caf › wafu
71
96
  gn Guinea, GUI, fifa › caf › wafu
@@ -73,6 +98,7 @@ gw Guinea-Bissau, GNB, fifa › caf › wafu
73
98
  lr Liberia, LBR, fifa › caf › wafu
74
99
  ml Mali, MLI, fifa › caf › wafu
75
100
  mr Mauritania, MTN, fifa › caf › wafu
101
+ | Mauretanien [de]
76
102
  ne Niger, NIG, fifa › caf › wafu
77
103
  ng Nigeria, NGA, fifa › caf › wafu
78
104
  sn Senegal, SEN, fifa › caf › wafu
@@ -83,5 +109,5 @@ tg Togo, TOG, fifa › caf › wafu
83
109
  # Territories & Dependencies
84
110
  re Réunion › FR, REU, caf # note: NOT fifa member
85
111
  zan Zanzibar › TZ, ZAN, caf › cecafa # note: NOT fifa member -- is a semi-autonomous region of Tanzania
86
-
112
+ | Sansibar [de]
87
113
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  ### Central Asia
7
7
  kz Kazakhstan, KAZ, fifa › uefa # note: was formerly a member of AFC (1993–2002)
8
+ | Kasachstan [de]
8
9
  kg Kyrgyzstan, KGZ, fifa › afc › cafa
9
10
  | Kyrgyz Republic
10
11
  tj Tajikistan, TJK, fifa › afc › cafa
@@ -11,38 +11,54 @@ at Austria, AUT, fifa › uefa
11
11
 
12
12
  by Belarus, BLR, fifa › uefa
13
13
  be Belgium, BEL, fifa › uefa
14
+ | Belgien [de]
14
15
  ba Bosnia and Herzegovina, BIH, fifa › uefa
15
16
  | Bosnia-Herzegovina | Bosnia | Bosnia-Herz. # add Bosnia Herzegovina?
17
+ | Bosnien-Herzegowina [de]
16
18
  bg Bulgaria, BUL, fifa › uefa
19
+ | Bulgarien [de]
17
20
 
18
21
  hr Croatia, CRO, fifa › uefa
19
22
  | Hrvatska [hr]
23
+ | Kroatien [de]
20
24
  cy Cyprus, CYP, fifa › uefa
25
+ | Zypern [de]
21
26
  cz Czech Republic, CZE, fifa › uefa
22
27
  | Czechia
28
+ | Tschechien [de]
23
29
 
24
30
  dk Denmark, DEN, fifa › uefa
31
+ | Dänemark [de]
25
32
 
26
33
  ee Estonia, EST, fifa › uefa
27
34
  es Spain, ESP, fifa › uefa
28
35
  | España [es]
36
+ | Spanien [de]
29
37
 
30
38
  fi Finland, FIN, fifa › uefa
39
+ | Finnland [de]
31
40
  fr France, FRA, fifa › uefa
41
+ | Frankreich [de]
32
42
 
33
43
  de Germany, GER, fifa › uefa
34
44
  | Deutschland [de]
35
45
  gr Greece, GRE, fifa › uefa
46
+ | Griechenland [de]
36
47
 
37
48
  hu Hungary, HUN, fifa › uefa
49
+ | Ungarn [de]
38
50
 
39
51
  is Iceland, ISL, fifa › uefa
52
+ | Island [de]
40
53
  it Italy, ITA, fifa › uefa
54
+ | Italien [de]
41
55
  ie Ireland, IRL, fifa › uefa
42
56
  | Republic of Ireland
57
+ | Irland [de]
43
58
 
44
59
  lv Latvia, LVA, fifa › uefa
45
60
  | Latvija
61
+ | Lettland [de]
46
62
  li Liechtenstein, LIE, fifa › uefa
47
63
  lt Lithuania, LTU, fifa › uefa
48
64
  lu Luxembourg, LUX, fifa › uefa
@@ -55,41 +71,61 @@ mk North Macedonia, MKD, fifa › uefa
55
71
 
56
72
  mt Malta, MLT, fifa › uefa
57
73
  md Moldova, MDA, fifa › uefa
74
+ | Moldau [de]
58
75
  me Montenegro, MNE, fifa › uefa
59
76
 
60
77
  nl Netherlands, NED, fifa › uefa
78
+ | Niederlande [de]
61
79
  no Norway, NOR, fifa › uefa
80
+ | Norwegen [de]
62
81
 
63
82
  pl Poland, POL, fifa › uefa
83
+ | Polen [de]
64
84
  pt Portugal, POR, fifa › uefa
65
85
 
66
86
  ro Romania, ROU, fifa › uefa
87
+ | Rumänien [de]
67
88
  ru Russia, RUS, fifa › uefa
68
89
 
69
90
  sm San Marino, SMR, fifa › uefa
70
91
  rs Serbia, SRB, fifa › uefa
92
+ | Serbien [de]
71
93
  sk Slovakia, SVK, fifa › uefa
94
+ | Slowakei [de]
72
95
  si Slovenia, SVN, fifa › uefa
96
+ | Slowenien [de]
73
97
  se Sweden, SWE, fifa › uefa
98
+ | Schweden [de]
74
99
  ch Switzerland, SUI, fifa › uefa
75
100
  | Confoederatio Helvetica
101
+ | Schweiz [de]
76
102
 
77
103
  tr Turkey, TUR, fifa › uefa
104
+ | Türkei [de]
78
105
  ua Ukraine, UKR, fifa › uefa
79
106
 
80
- xk Kosovo, KVX, fifa uefa # -- note: Kosovo is not listed as an ISO standard country. The unofficial 2 and 3-digit codes are used by the European Commission and others until Kosovo is assigned an ISO code
81
- | KOS # note: KOS used by UEFA, KVX by FIFA (use FIFA code for now)
107
+ ## old kosovo version
108
+ # -- note: Kosovo is not listed as an ISO standard country. The unofficial 2 and 3-digit codes are used by the European Commission and others until Kosovo is assigned an ISO code
109
+ # note: KOS used by UEFA, KVX by FIFA (use FIFA code for now)
110
+ # xk Kosovo, KVX, fifa › uefa
111
+ # | KOS
112
+
113
+ kos Kosovo, KOS, fifa › uefa
114
+ | kvx | xk
82
115
 
83
116
  ## south caucasus
84
117
  ## - add to middle east?
85
118
 
86
119
  am Armenia, ARM, fifa › uefa
120
+ | Armenien [de]
87
121
  az Azerbaijan, AZE, fifa › uefa
122
+ | Aserbaidschan [de]
88
123
  ge Georgia, GEO, fifa › uefa
89
124
 
90
125
 
91
126
  # Territories & Dependencies
92
127
  fo Faroe Islands › DK, FRO, fifa › uefa
128
+ | Färöer [de]
93
129
  gi Gibraltar › UK, GIB, fifa › uefa
94
130
 
95
131
  nkr Artsakh › AZ, NKR # note: NOT fifa or uefa member
@@ -106,8 +142,10 @@ uk Great Britain, GBR # note: NOT fifa or uefa member
106
142
  eng England › UK, ENG, fifa › uefa
107
143
  wal Wales › UK, WAL, fifa › uefa
108
144
  sco Scotland › UK, SCO, fifa › uefa
145
+ | Schottland [de]
109
146
  nir Northern Ireland › UK, NIR, fifa › uefa
110
147
  | N. Ireland
148
+ | Nordirland [de]
111
149
 
112
150
  ## irregular codes
113
151
  va Vatican City, VAT ## no "official" fifa code - listed in "irregular" codes
@@ -17,6 +17,7 @@ class CountryIndex
17
17
  def initialize( recs=nil )
18
18
  @countries = []
19
19
  @by_code = {} ## countries by codes (fifa, internet, etc)
20
+ @by_name = {} ## normalized name
20
21
  @orgs = OrgIndex.new
21
22
 
22
23
  add( recs ) if recs
@@ -38,11 +39,25 @@ class CountryIndex
38
39
 
39
40
 
40
41
  def find( q )
41
- key = q.to_s.downcase ## allow symbols (and always downcase e.g. AUT to aut etc.)
42
+ ## todo/fix - add find by name (find_by_name_and_code) - why? why not?
43
+ find_by_code( q )
44
+ end
45
+
46
+ def find_by_code( code )
47
+ key = code.to_s.downcase ## allow symbols (and always downcase e.g. AUT to aut etc.)
42
48
  @by_code[ key ]
43
49
  end
44
- alias_method :[], :find
50
+ alias_method :[], :find_by_code
51
+
52
+ def find_by_name( name )
53
+ key = normalize( unaccent( name.to_s ))
54
+ @by_name[ key ]
55
+ end
56
+
57
+
45
58
 
59
+ include SportDb::NameHelper
60
+ ## strip_year, strip_lang, normalize etc.
46
61
 
47
62
 
48
63
  def add( recs )
@@ -55,15 +70,36 @@ class CountryIndex
55
70
 
56
71
  def _add( recs )
57
72
  recs.each do |rec|
58
- key = rec.code.downcase ## add codes lookups - key, fifa, ...
73
+ ## step 1 - add code lookups - key, fifa, ...
74
+ ## todo/fix - add two-letter keys and alt keys - why? why not?
75
+ key = rec.code.downcase
59
76
  if @by_code[ key ]
60
77
  puts "** !!! ERROR !!! country code (fifa) >#{rec.code}< already exits!!"
61
78
  exit 1
62
79
  else
63
80
  @by_code[ key ] = rec
64
81
  end
82
+
83
+
84
+ ## step 2 - add name lookups
85
+ keys = [ normalize( unaccent( strip_year( rec.name ))) ]
86
+
87
+ rec.alt_names.each do |name|
88
+ keys << normalize( unaccent( strip_year(strip_lang(name)) ))
89
+ end
90
+ ## note - allow duplicates only if same country
91
+ ## e.g Panama, Panamá
92
+ keys = keys.uniq
93
+
94
+ keys.each do |key|
95
+ if @by_name[ key ]
96
+ puts "** !!! ERROR country (norm) name >#{key}< already exits"
97
+ exit 1
98
+ else
99
+ @by_name[ key ] = rec
100
+ end
101
+ end
65
102
  end
66
103
  end # method add
67
104
  end # class CountryIndex
68
-
69
- end # class Module
105
+ end # module Fifa
data/lib/fifa/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  module Fifa
3
3
  MAJOR = 2024 ## todo: namespace inside version or something - why? why not??
4
- MINOR = 9
5
- PATCH = 22
4
+ MINOR = 10
5
+ PATCH = 5
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
data/lib/fifa.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  ## 3rd party gems
2
2
  require 'sportdb/structs' ## pull-in Sports::Country
3
+ require 'alphabets'
3
4
 
4
5
 
5
6
  ###
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fifa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2024.9.22
4
+ version: 2024.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-22 00:00:00.000000000 Z
11
+ date: 2024-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-structs
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: alphabets
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rdoc
29
43
  requirement: !ruby/object:Gem::Requirement