sportdb-market 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sportdb/market/market.rb +1 -0
- data/lib/sportdb/market/reader.rb +14 -3
- data/lib/sportdb/market/version.rb +1 -1
- metadata +3 -3
@@ -168,14 +168,25 @@ private
|
|
168
168
|
find_team_worker!( line, 2 )
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
|
172
172
|
def match_team_worker!( line, key, values )
|
173
173
|
values.each do |value|
|
174
|
-
|
174
|
+
## todo: how to mark value as regex?
|
175
|
+
## for now escape regex special chars e.g. . to \.
|
176
|
+
value_for_regex = value.gsub( '.', '\.' ) # e.g. Benfica Lis.
|
177
|
+
|
178
|
+
## fix: todo: match accented char with or without accents
|
179
|
+
## add (ü|ue) etc.
|
180
|
+
## also make - optional change to (-| ) e.g. Blau-Weiss == Blau Weiss
|
181
|
+
## reuse for all readers!
|
182
|
+
|
183
|
+
## nb: \b does NOT include space or newline for word boundry (only alphanums e.g. a-z0-9)
|
184
|
+
## (thus add it, allows match for Benfica Lis. for example - note . at the end)
|
185
|
+
regex = /\b#{value_for_regex}[\b\s]/ # wrap with world boundry (e.g. match only whole words e.g. not wac in wacker)
|
175
186
|
if line =~ regex
|
176
187
|
puts " match for team >#{key}< >#{value}<"
|
177
188
|
# make sure @@oo{key}oo@@ doesn't match itself with other key e.g. wacker, wac, etc.
|
178
|
-
line.sub!( regex, "@@oo#{key}oo@@" )
|
189
|
+
line.sub!( regex, "@@oo#{key}oo@@ " ) # NB: add one space char at end
|
179
190
|
return true # break out after first match (do NOT continue)
|
180
191
|
end
|
181
192
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-market
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerald Bauer
|