sportdb-models 1.14.2 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sportdb/readers/game.rb +34 -9
- data/lib/sportdb/utils_teams.rb +6 -1
- data/lib/sportdb/version.rb +2 -2
- metadata +4 -5
- data/.gemtest +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd4954a8fe9eafb1880ac4d2ce1aef869c7e52a
|
4
|
+
data.tar.gz: 5ccd5c5c17e87a810660342ae15bbb74ec37db24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a92900f689e5da69210adb12a4e0265dddd14059cb17dc176d6c017e52db032234c7c6bae38db07e65102c92b6383d56cdc0f99d8f99d4ee53ac7d40ed353f
|
7
|
+
data.tar.gz: 90357b9ea35cb0d8e62d9fbc48096cbf76db007c9443c4e8e81de59e4a50ae18fcd525344648ab30e91fe2665c11120d757c1c16541a78dc6541fab50f1881cd
|
data/lib/sportdb/readers/game.rb
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
module SportDb
|
4
4
|
|
5
5
|
|
6
|
+
class TeamMapper
|
7
|
+
def initialize( recs )
|
8
|
+
@mapper = TextUtils::TitleMapper2.new( recs, 'team' )
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_teams!( line ) # Note: returns an array - note: plural! (teamsssss)
|
12
|
+
@mapper.find_keys!( line )
|
13
|
+
end
|
14
|
+
|
15
|
+
def find_team!( line ) # Note: returns key (string or nil)
|
16
|
+
@mapper.find_key!( line )
|
17
|
+
end
|
18
|
+
|
19
|
+
def map_teams!( line )
|
20
|
+
@mapper.map_titles!( line )
|
21
|
+
end
|
22
|
+
end # class TeamMapper
|
23
|
+
|
24
|
+
|
25
|
+
|
6
26
|
class GameReader
|
7
27
|
|
8
28
|
include LogUtils::Logging
|
@@ -172,7 +192,10 @@ class GameReader
|
|
172
192
|
logger.debug "Event #{@event.key} >#{@event.title}<"
|
173
193
|
|
174
194
|
### fix: use build_title_table_for ??? why? why not??
|
175
|
-
@known_teams = @event.known_teams_table
|
195
|
+
## @known_teams = @event.known_teams_table
|
196
|
+
|
197
|
+
@mapper_teams = TeamMapper.new( @event.teams )
|
198
|
+
|
176
199
|
|
177
200
|
@known_grounds = TextUtils.build_title_table_for( @event.grounds )
|
178
201
|
|
@@ -208,8 +231,8 @@ class GameReader
|
|
208
231
|
def parse_group_def( line )
|
209
232
|
logger.debug "parsing group def line: >#{line}<"
|
210
233
|
|
211
|
-
|
212
|
-
team_keys = find_teams!( line )
|
234
|
+
@mapper_teams.map_teams!( line )
|
235
|
+
team_keys = @mapper_teams.find_teams!( line )
|
213
236
|
|
214
237
|
title, pos = find_group_title_and_pos!( line )
|
215
238
|
|
@@ -417,9 +440,10 @@ class GameReader
|
|
417
440
|
def parse_game( line )
|
418
441
|
logger.debug "parsing game (fixture) line: >#{line}<"
|
419
442
|
|
420
|
-
|
421
|
-
|
422
|
-
|
443
|
+
@mapper_teams.map_teams!( line ) ### todo/fix: limit mapping to two(2) teams - why? why not? might avoid matching @ Barcelona ??
|
444
|
+
team_keys = @mapper_teams.find_teams!( line )
|
445
|
+
team1_key = team_keys[0]
|
446
|
+
team2_key = team_keys[1]
|
423
447
|
|
424
448
|
## note: if we do NOT find two teams; return false - no match found
|
425
449
|
if team1_key.nil? || team2_key.nil?
|
@@ -634,9 +658,10 @@ class GameReader
|
|
634
658
|
# Jun/17: etc.
|
635
659
|
|
636
660
|
|
637
|
-
|
638
|
-
|
639
|
-
|
661
|
+
@mapper_teams.map_teams!( line )
|
662
|
+
team_keys = @mapper_teams.find_teams!( line )
|
663
|
+
team1_key = team_keys[0]
|
664
|
+
team2_key = team_keys[1]
|
640
665
|
|
641
666
|
date = find_date!( line, start_at: @event.start_at )
|
642
667
|
|
data/lib/sportdb/utils_teams.rb
CHANGED
@@ -5,25 +5,30 @@ module SportDb
|
|
5
5
|
|
6
6
|
|
7
7
|
def find_teams!( line ) # NB: returns an array - note: plural! (teamsss)
|
8
|
+
puts "*** find_teams! deprecated -- use TeamMapper!!!"
|
8
9
|
TextUtils.find_keys_for!( 'team', line )
|
9
10
|
end
|
10
11
|
|
11
12
|
def find_team!( line ) # NB: returns key (string or nil)
|
13
|
+
puts "*** find_team! deprecated -- use TeamMapper!!!"
|
12
14
|
TextUtils.find_key_for!( 'team', line )
|
13
15
|
end
|
14
16
|
|
15
17
|
## todo: check if find_team1 gets used? if not remove it!! use find_teams!
|
16
18
|
def find_team1!( line )
|
19
|
+
puts "*** find_team1! deprecated -- use TeamMapper!!!"
|
17
20
|
TextUtils.find_key_for!( 'team1', line )
|
18
21
|
end
|
19
22
|
|
20
23
|
def find_team2!( line )
|
24
|
+
puts "*** find_team2! deprecated -- use TeamMapper!!!"
|
21
25
|
TextUtils.find_key_for!( 'team2', line )
|
22
26
|
end
|
23
27
|
|
24
28
|
## todo/fix: pass in known_teams as a parameter? why? why not?
|
25
29
|
|
26
30
|
def map_teams!( line )
|
31
|
+
puts "*** map_teams! deprecated -- use TeamMapper!!!"
|
27
32
|
TextUtils.map_titles_for!( 'team', line, @known_teams )
|
28
33
|
end
|
29
34
|
|
@@ -40,4 +45,4 @@ module SportDb
|
|
40
45
|
|
41
46
|
|
42
47
|
end # module FixtureHelpers
|
43
|
-
end # module SportDb
|
48
|
+
end # module SportDb
|
data/lib/sportdb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: worlddb-models
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.14'
|
69
69
|
description: sportdb-models - sport.db schema 'n' models for easy (re)use
|
70
70
|
email: opensport@googlegroups.com
|
71
71
|
executables: []
|
@@ -75,7 +75,6 @@ extra_rdoc_files:
|
|
75
75
|
- Manifest.txt
|
76
76
|
- README.md
|
77
77
|
files:
|
78
|
-
- ".gemtest"
|
79
78
|
- HISTORY.md
|
80
79
|
- Manifest.txt
|
81
80
|
- README.md
|
data/.gemtest
DELETED
File without changes
|