fifa 2024.9.22 → 2024.9.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/config/europe/countries.txt +8 -2
- data/lib/fifa/country_index.rb +41 -5
- data/lib/fifa/version.rb +1 -1
- data/lib/fifa.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1616a8e1385d8ece752e63a5fc1a44ff0f2ee9d4f6ab40d0774f151fa544025e
|
4
|
+
data.tar.gz: f4b8e17cce0e1a9a353520f6726a071ac0fb33dbd1c95490e323c56e4c3b366f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff004e8985804a8ac8f6b51e3db0f40acd4bf00593fb19f5ea58e02d32fca3be8664dd3aa500c8553f49a59299791affd3c6d300d8b90a924f84c06540ae2187
|
7
|
+
data.tar.gz: 49831c5e0da0491506a54f7c9064ee0f5aecf9651bb75ea93ea4b2e4ae1707f053c6c3d3d79f1f58599b92d3f51c1bfad8853941cce2140a3412906bf7b11011
|
data/CHANGELOG.md
CHANGED
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/
|
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
data/config/europe/countries.txt
CHANGED
@@ -77,8 +77,14 @@ ch Switzerland, SUI, fifa › uefa
|
|
77
77
|
tr Turkey, TUR, fifa › uefa
|
78
78
|
ua Ukraine, UKR, fifa › uefa
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
## old kosovo version
|
81
|
+
# -- 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
|
82
|
+
# note: KOS used by UEFA, KVX by FIFA (use FIFA code for now)
|
83
|
+
# xk Kosovo, KVX, fifa › uefa
|
84
|
+
# | KOS
|
85
|
+
|
86
|
+
kos Kosovo, KOS, fifa › uefa
|
87
|
+
| kvx | xk
|
82
88
|
|
83
89
|
## south caucasus
|
84
90
|
## - add to middle east?
|
data/lib/fifa/country_index.rb
CHANGED
@@ -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
|
-
|
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 :[], :
|
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
|
-
|
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
data/lib/fifa.rb
CHANGED
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.
|
4
|
+
version: 2024.9.24
|
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-
|
11
|
+
date: 2024-09-24 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
|