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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 179911cd446977787834641fb8b19728b05d0e4a
4
- data.tar.gz: 61469a6cb2ffa0b24f3567c7e263d62fded9250f
3
+ metadata.gz: dfd4954a8fe9eafb1880ac4d2ce1aef869c7e52a
4
+ data.tar.gz: 5ccd5c5c17e87a810660342ae15bbb74ec37db24
5
5
  SHA512:
6
- metadata.gz: 4ffd8c25d110694f82f32205fc79b108375f85f705815be5288cddc058ac964f0a4a24c0541f53226e008bb3c4f818cf59dec62a55550fdeefd1e648b50623bf
7
- data.tar.gz: 680a475c8be1cffc47740e7c0b72354073d99bc44930d1ee1f58bcdec3d4f5fcfbe11c9219df757495d5f102602b0738b63ae8b6204ee9438bec82d7ae1789d5
6
+ metadata.gz: 94a92900f689e5da69210adb12a4e0265dddd14059cb17dc176d6c017e52db032234c7c6bae38db07e65102c92b6383d56cdc0f99d8f99d4ee53ac7d40ed353f
7
+ data.tar.gz: 90357b9ea35cb0d8e62d9fbc48096cbf76db007c9443c4e8e81de59e4a50ae18fcd525344648ab30e91fe2665c11120d757c1c16541a78dc6541fab50f1881cd
@@ -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
- match_teams!( line )
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
- match_teams!( line )
421
- team1_key = find_team1!( line )
422
- team2_key = find_team2!( line )
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
- match_teams!( line )
638
- team1_key = find_team1!( line )
639
- team2_key = find_team2!( line )
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
 
@@ -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
@@ -3,8 +3,8 @@
3
3
  module SportDb
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 14
7
- PATCH = 2
6
+ MINOR = 15
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
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.14.2
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-09-17 00:00:00.000000000 Z
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.13'
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.13'
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