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.
@@ -100,6 +100,7 @@ module SportDB::Market
100
100
 
101
101
  # delete ALL records (use with care!)
102
102
  def self.delete!
103
+ puts '*** deleting sport market table records/data...'
103
104
  Deleter.new.run
104
105
  end # method delete!
105
106
 
@@ -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
- regex = Regexp.new( "\\b#{value}\\b" ) # wrap with world boundry (e.g. match only whole words e.g. not wac in wacker)
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
@@ -2,5 +2,5 @@
2
2
  module SportDB ; end # forward reference (for hoe require)
3
3
 
4
4
  module SportDB::Market
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer