sportdb-formats 1.1.6 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +2 -0
- data/Manifest.txt +4 -25
- data/Rakefile +1 -1
- data/lib/sportdb/formats/country/country_reader.rb +142 -142
- data/lib/sportdb/formats/datafile.rb +59 -59
- data/lib/sportdb/formats/event/event_reader.rb +184 -183
- data/lib/sportdb/formats/goals.rb +53 -9
- data/lib/sportdb/formats/ground/ground_reader.rb +289 -0
- data/lib/sportdb/formats/league/league_reader.rb +152 -168
- data/lib/sportdb/formats/lines_reader.rb +47 -0
- data/lib/sportdb/formats/match/match_parser.rb +130 -13
- data/lib/sportdb/formats/match/match_parser_auto_conf.rb +270 -202
- data/lib/sportdb/formats/outline_reader.rb +0 -1
- data/lib/sportdb/formats/package.rb +394 -374
- data/lib/sportdb/formats/search/sport.rb +357 -0
- data/lib/sportdb/formats/search/world.rb +139 -0
- data/lib/sportdb/formats/team/club_index_history.rb +134 -134
- data/lib/sportdb/formats/team/club_reader.rb +318 -350
- data/lib/sportdb/formats/team/club_reader_history.rb +203 -203
- data/lib/sportdb/formats/team/wiki_reader.rb +108 -108
- data/lib/sportdb/formats/version.rb +4 -7
- data/lib/sportdb/formats.rb +60 -27
- metadata +13 -35
- data/lib/sportdb/formats/country/country_index.rb +0 -192
- data/lib/sportdb/formats/event/event_index.rb +0 -141
- data/lib/sportdb/formats/league/league_index.rb +0 -178
- data/lib/sportdb/formats/team/club_index.rb +0 -338
- data/lib/sportdb/formats/team/national_team_index.rb +0 -114
- data/lib/sportdb/formats/team/team_index.rb +0 -43
- data/test/helper.rb +0 -132
- data/test/test_club_index.rb +0 -183
- data/test/test_club_index_history.rb +0 -107
- data/test/test_club_reader.rb +0 -201
- data/test/test_club_reader_history.rb +0 -212
- data/test/test_club_reader_props.rb +0 -54
- data/test/test_country_index.rb +0 -63
- data/test/test_country_reader.rb +0 -89
- data/test/test_datafile.rb +0 -30
- data/test/test_datafile_package.rb +0 -46
- data/test/test_goals.rb +0 -113
- data/test/test_league_index.rb +0 -157
- data/test/test_league_outline_reader.rb +0 -55
- data/test/test_league_reader.rb +0 -72
- data/test/test_outline_reader.rb +0 -31
- data/test/test_package.rb +0 -78
- data/test/test_package_match.rb +0 -102
- data/test/test_regex.rb +0 -67
- data/test/test_wiki_reader.rb +0 -77
@@ -1,350 +1,318 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
##
|
28
|
-
## (
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
##
|
38
|
-
##
|
39
|
-
## Fischhofgasse 12
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
##
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
##
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
end
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
recs << rec
|
320
|
-
end
|
321
|
-
end # each line (in paragraph)
|
322
|
-
else
|
323
|
-
puts "** !!! ERROR !!! [club reader] - unknown line type:"
|
324
|
-
pp node
|
325
|
-
exit 1
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
recs
|
330
|
-
end # method read
|
331
|
-
|
332
|
-
#######################
|
333
|
-
### helpers
|
334
|
-
def split_geo( str )
|
335
|
-
## assume city / geo tree
|
336
|
-
## strip and squish (white)spaces
|
337
|
-
# e.g. León › Guanajuato => León › Guanajuato
|
338
|
-
str = str.strip.gsub( /[ \t]+/, ' ' )
|
339
|
-
|
340
|
-
## split into geo tree
|
341
|
-
geos = str.split( /[<>‹›]/ ) ## note: allow > < or › ‹
|
342
|
-
geos = geos.map { |geo| geo.strip } ## remove all whitespaces
|
343
|
-
geos
|
344
|
-
end
|
345
|
-
|
346
|
-
end # class ClubReader
|
347
|
-
|
348
|
-
|
349
|
-
end ## module Import
|
350
|
-
end ## module SportDb
|
1
|
+
|
2
|
+
module SportDb
|
3
|
+
module Import
|
4
|
+
|
5
|
+
|
6
|
+
class ClubReader
|
7
|
+
|
8
|
+
def world() Import.world; end
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
def self.read( path ) ## use - rename to read_file or from_file etc. - why? why not?
|
13
|
+
txt = File.open( path, 'r:utf-8' ) { |f| f.read }
|
14
|
+
parse( txt )
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.parse( txt )
|
18
|
+
new( txt ).parse
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize( txt )
|
22
|
+
@txt = txt
|
23
|
+
end
|
24
|
+
|
25
|
+
## pattern for b (child) team / club marker e.g.
|
26
|
+
## (ii) or ii) or ii.) or (ii.) or (II)
|
27
|
+
## (b) or b) or b.) or (b.) or (B)
|
28
|
+
## (2) or 2) or 2.) or (2.)
|
29
|
+
B_TEAM_MARKER_RE = %r{^ \(? # optional opening bracket
|
30
|
+
(?: ii|b|2 )
|
31
|
+
\.? # optional dot - keep and allow dot - why? why not?
|
32
|
+
\) # required closing bracket
|
33
|
+
}xi ## note: add case-insenstive (e.g. II/ii or B/b)
|
34
|
+
|
35
|
+
## pattern for checking for address line e.g.
|
36
|
+
## use just one style / syntax - why? why not?
|
37
|
+
## Fischhofgasse 12 ~ 1100 Wien or
|
38
|
+
## Fischhofgasse 12 // 1100 Wien or Fischhofgasse 12 /// 1100 Wien
|
39
|
+
## Fischhofgasse 12 ++ 1100 Wien or Fischhofgasse 12 +++ 1100 Wien
|
40
|
+
ADDR_MARKER_RE = %r{ (?: ^|[ ] ) # space or beginning of line
|
41
|
+
(?: ~ | /{2,} | \+{2,} )
|
42
|
+
(?: [ ]|$) # space or end of line
|
43
|
+
}x
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
def parse
|
48
|
+
recs = []
|
49
|
+
last_rec = nil
|
50
|
+
headings = [] ## headings stack
|
51
|
+
|
52
|
+
OutlineReader.parse( @txt ).each do |node|
|
53
|
+
if [:h1,:h2,:h3,:h4,:h5,:h6].include?( node[0] )
|
54
|
+
heading_level = node[0][1].to_i
|
55
|
+
heading = node[1]
|
56
|
+
|
57
|
+
puts "heading #{heading_level} >#{heading}<"
|
58
|
+
|
59
|
+
## 1) first pop headings if present
|
60
|
+
while headings.size+1 > heading_level
|
61
|
+
headings.pop
|
62
|
+
end
|
63
|
+
|
64
|
+
## 2) add missing (hierarchy) level if
|
65
|
+
while headings.size+1 < heading_level
|
66
|
+
## todo/fix: issue warning about "skipping" hierarchy level
|
67
|
+
puts "!!! warn [team reader] - skipping hierarchy level in headings "
|
68
|
+
headings.push( nil )
|
69
|
+
end
|
70
|
+
|
71
|
+
if heading =~ /^\?+$/ ## note: use ? or ?? or ?? to reset level to nil
|
72
|
+
## keep level empty
|
73
|
+
else
|
74
|
+
## note: if level is 1 assume country for now
|
75
|
+
if heading_level == 1
|
76
|
+
## assume country in heading; allow all "formats" supported by parse e.g.
|
77
|
+
## Österreich • Austria (at)
|
78
|
+
## Österreich • Austria
|
79
|
+
## Austria
|
80
|
+
## Deutschland (de) • Germany
|
81
|
+
country = world.countries.parse( heading )
|
82
|
+
## check country code - MUST exist for now!!!!
|
83
|
+
if country.nil?
|
84
|
+
puts "!!! error [club reader] - unknown country >#{heading}< - sorry - add country to config to fix"
|
85
|
+
exit 1
|
86
|
+
end
|
87
|
+
|
88
|
+
headings.push( country.key )
|
89
|
+
else
|
90
|
+
## quick hack:
|
91
|
+
## remove known fill/dummy words incl:
|
92
|
+
## Provincia San Juan => San Juan (see argentina, for example)
|
93
|
+
##
|
94
|
+
## use geo tree long term with alternative names - why? why not?
|
95
|
+
words = ['Provincia']
|
96
|
+
words.each { |word| heading = heading.gsub( word, '' ) }
|
97
|
+
heading = heading.strip
|
98
|
+
|
99
|
+
headings.push( heading )
|
100
|
+
end
|
101
|
+
|
102
|
+
## assert that hierarchy level is ok
|
103
|
+
if headings.size != heading_level
|
104
|
+
puts "!!! error - headings hierarchy/stack out of order - #{heading.size}<=>#{heading_level}"
|
105
|
+
exit 1
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
pp headings
|
110
|
+
|
111
|
+
elsif node[0] == :p ## paragraph with (text) lines
|
112
|
+
lines = node[1]
|
113
|
+
lines.each do |line|
|
114
|
+
if line.start_with?( '|' )
|
115
|
+
## assume continuation with line of alternative names
|
116
|
+
## note: skip leading pipe
|
117
|
+
values = line[1..-1].split( '|' ) # team names - allow/use pipe(|)
|
118
|
+
values = values.map {|value| _norm(value) } ## squish/strip etc.
|
119
|
+
|
120
|
+
last_rec.alt_names += values
|
121
|
+
|
122
|
+
## check for b (child) team / club marker e.g.
|
123
|
+
## (ii) or ii) or ii.) or (ii.)
|
124
|
+
## (b) or b) or b.) or (b.)
|
125
|
+
## (2) or 2) or 2.) or (2.)
|
126
|
+
elsif line =~ B_TEAM_MARKER_RE
|
127
|
+
line = line.sub( B_TEAM_MARKER_RE, '' ).strip ## remove (leading) b team marker
|
128
|
+
|
129
|
+
## todo/fix: move into "regular" club branch - (re)use, that is, use the same code
|
130
|
+
# for both a and b team / club
|
131
|
+
rec = Club.new
|
132
|
+
## note: assume / allow just canonical name for now
|
133
|
+
## strip and squish (white)spaces
|
134
|
+
# e.g. New York FC (2011-) => New York FC (2011-)
|
135
|
+
rec.name = _norm( line ) # canoncial name (global unique "beautiful/long" name)
|
136
|
+
|
137
|
+
### link a and b team / clubs
|
138
|
+
## assume last_rec is the a team
|
139
|
+
## todo/fix: check last_rec required NOT null
|
140
|
+
rec.a = last_rec
|
141
|
+
last_rec.b = rec
|
142
|
+
|
143
|
+
last_rec = rec
|
144
|
+
recs << rec
|
145
|
+
|
146
|
+
## check for address line e.g.
|
147
|
+
## use just one style / syntax - why? why not?
|
148
|
+
## Fischhofgasse 12 ~ 1100 Wien or
|
149
|
+
## Fischhofgasse 12 // 1100 Wien or Fischhofgasse 12 /// 1100 Wien
|
150
|
+
## Fischhofgasse 12 ++ 1100 Wien or Fischhofgasse 12 +++ 1100 Wien
|
151
|
+
elsif line =~ ADDR_MARKER_RE
|
152
|
+
last_rec.address = _squish( line )
|
153
|
+
else
|
154
|
+
values = line.split( ',' )
|
155
|
+
|
156
|
+
rec = Club.new
|
157
|
+
|
158
|
+
col = values.shift ## get first item
|
159
|
+
## note: allow optional alt names for convenience with required canoncial name
|
160
|
+
names = col.split( '|' ) # team names - allow/use pipe(|)
|
161
|
+
names = names.map {|name| _norm(name) } ## squish/strip etc.
|
162
|
+
|
163
|
+
value = names[0] ## canonical name
|
164
|
+
alt_names = names[1..-1] ## optional (inline) alt names
|
165
|
+
|
166
|
+
rec.name = value # canoncial name (global unique "beautiful/long" name)
|
167
|
+
## note: add optional (inline) alternate names if present
|
168
|
+
rec.alt_names += alt_names if alt_names.size > 0
|
169
|
+
|
170
|
+
## note:
|
171
|
+
## check/todo!!!!!!!!!!!!!!!!!-
|
172
|
+
## strip year if to present e.g. (2011-)
|
173
|
+
##
|
174
|
+
## do NOT strip for defunct / historic clubs e.g.
|
175
|
+
## (1899-1910)
|
176
|
+
## or (-1914) or (-2011) etc.
|
177
|
+
|
178
|
+
###
|
179
|
+
## todo: move year out of canonical team name - why? why not?
|
180
|
+
|
181
|
+
## check if canonical name include (2011-) or similar in name
|
182
|
+
## if yes, remove (2011-) and add to (alt) names
|
183
|
+
## e.g. New York FC (2011) => New York FC
|
184
|
+
if rec.name =~ /\(.+?\)/ ## note: use non-greedy (?) match
|
185
|
+
name = rec.name.gsub( /\(.+?\)/, '' ).strip
|
186
|
+
|
187
|
+
if rec.name =~ /\(([0-9]{4})-\)/ ## e.g. (2014-)
|
188
|
+
rec.year = $1.to_i
|
189
|
+
elsif rec.name =~ /\(-([0-9]{4})\)/ ## e.g. (-2014)
|
190
|
+
rec.year_end = $1.to_i
|
191
|
+
elsif rec.name =~ /\(([0-9]{4})-([0-9]{4})\)/ ## e.g. (2011-2014)
|
192
|
+
rec.year = $1.to_i
|
193
|
+
rec.year_end = $2.to_i
|
194
|
+
else
|
195
|
+
## todo/check: warn about unknown year format
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
## todo/check - check for unknown format values
|
200
|
+
## e.g. too many values, duplicate years, etc.
|
201
|
+
## check for overwritting, etc.
|
202
|
+
|
203
|
+
## strip and squish (white)spaces
|
204
|
+
# e.g. León › Guanajuato => León › Guanajuato
|
205
|
+
values = values.map {|value| _squish(value) }
|
206
|
+
|
207
|
+
while values.size > 0
|
208
|
+
value = values.shift
|
209
|
+
if value =~/^\d{4}$/ # e.g 1904
|
210
|
+
## todo/check: issue warning if year is already set!!!!!!!
|
211
|
+
if rec.year
|
212
|
+
puts "!!! error - year already set to #{rec.year} - CANNOT overwrite with #{value}:"
|
213
|
+
pp rec
|
214
|
+
exit 1
|
215
|
+
end
|
216
|
+
rec.year = value.to_i
|
217
|
+
elsif value.start_with?( '@' ) # e.g. @ Anfield
|
218
|
+
## cut-off leading @ and spaces
|
219
|
+
rec.ground = value[1..-1].strip
|
220
|
+
else
|
221
|
+
## assume city / geo tree
|
222
|
+
## split into geo tree
|
223
|
+
geos = split_geo( value )
|
224
|
+
city = geos[0]
|
225
|
+
## check for "embedded" district e.g. London (Fulham) or Hamburg (St. Pauli) etc.
|
226
|
+
if city =~ /\((.+?)\)/ ## note: use non-greedy (?) match
|
227
|
+
rec.district = $1.strip
|
228
|
+
city = city.gsub( /\(.+?\)/, '' ).strip
|
229
|
+
end
|
230
|
+
rec.city = city
|
231
|
+
|
232
|
+
if geos.size > 1
|
233
|
+
## cut-off city and keep the rest (of geo tree)
|
234
|
+
rec.geos = geos[1..-1]
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end ## while values
|
238
|
+
|
239
|
+
|
240
|
+
###############
|
241
|
+
## use headings text for geo tree
|
242
|
+
|
243
|
+
## 1) add country if present
|
244
|
+
if headings.size > 0 && headings[0]
|
245
|
+
country = world.countries.find( headings[0] )
|
246
|
+
rec.country = country
|
247
|
+
else
|
248
|
+
## make it an error - why? why not?
|
249
|
+
puts "!!! error - country missing in headings hierarchy - sorry - add to quicklist"
|
250
|
+
exit 1
|
251
|
+
end
|
252
|
+
|
253
|
+
## 2) check geo tree with headings hierarchy
|
254
|
+
if headings.size > 1 && headings[1]
|
255
|
+
geos = split_geo( headings[1] )
|
256
|
+
if rec.geos
|
257
|
+
if rec.geos[0] != geos[0]
|
258
|
+
puts "!!! error - geo tree - headings mismatch >#{rec.geos[0]}< <=> >#{geos[0]}<"
|
259
|
+
exit 1
|
260
|
+
end
|
261
|
+
if rec.geos[1] && rec.geos[1] != geos[1] ## check optional 2nd level too
|
262
|
+
puts "!!! error - geo tree - headings mismatch >#{rec.geos[1]}< <=> >#{geos[1]}<"
|
263
|
+
exit 1
|
264
|
+
end
|
265
|
+
else
|
266
|
+
## add missing region (state/province) from headings hierarchy
|
267
|
+
rec.geos = geos
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
last_rec = rec
|
272
|
+
|
273
|
+
recs << rec
|
274
|
+
end
|
275
|
+
end # each line (in paragraph)
|
276
|
+
else
|
277
|
+
puts "** !!! ERROR !!! [club reader] - unknown line type:"
|
278
|
+
pp node
|
279
|
+
exit 1
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
recs
|
284
|
+
end # method read
|
285
|
+
|
286
|
+
#######################
|
287
|
+
### helpers
|
288
|
+
def split_geo( str )
|
289
|
+
## assume city / geo tree
|
290
|
+
## strip and squish (white)spaces
|
291
|
+
# e.g. León › Guanajuato => León › Guanajuato
|
292
|
+
str = _squish( str )
|
293
|
+
|
294
|
+
## split into geo tree
|
295
|
+
geos = str.split( /[<>‹›]/ ) ## note: allow > < or › ‹
|
296
|
+
geos = geos.map { |geo| geo.strip } ## remove all whitespaces
|
297
|
+
geos
|
298
|
+
end
|
299
|
+
|
300
|
+
|
301
|
+
## norm(alize) helper - squish (spaces)
|
302
|
+
## and remove dollars ($$$)
|
303
|
+
## and remove leading and trailing spaces
|
304
|
+
def _norm( str )
|
305
|
+
## only extra clean-up of dollars for now ($$$)
|
306
|
+
_squish( str.gsub( '$', '' ) )
|
307
|
+
end
|
308
|
+
|
309
|
+
def _squish( str )
|
310
|
+
str.gsub( /[ \t\u00a0]+/, ' ' ).strip
|
311
|
+
end
|
312
|
+
|
313
|
+
|
314
|
+
end # class ClubReader
|
315
|
+
|
316
|
+
|
317
|
+
end ## module Import
|
318
|
+
end ## module SportDb
|