sportdb-models 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/HISTORY.md +21 -0
  4. data/Manifest.txt +142 -0
  5. data/README.md +28 -0
  6. data/Rakefile +59 -0
  7. data/config/fixtures/de.yml +46 -0
  8. data/config/fixtures/en.yml +54 -0
  9. data/config/fixtures/es.yml +48 -0
  10. data/config/fixtures/fr.yml +53 -0
  11. data/config/fixtures/it.yml +55 -0
  12. data/config/fixtures/pt.yml +46 -0
  13. data/config/fixtures/ro.yml +55 -0
  14. data/data/seasons.txt +74 -0
  15. data/data/setups/all.txt +5 -0
  16. data/lib/sportdb/calc.rb +279 -0
  17. data/lib/sportdb/deleter.rb +52 -0
  18. data/lib/sportdb/finders/date.rb +374 -0
  19. data/lib/sportdb/finders/goals.rb +260 -0
  20. data/lib/sportdb/finders/scores.rb +122 -0
  21. data/lib/sportdb/lang.rb +216 -0
  22. data/lib/sportdb/matcher.rb +31 -0
  23. data/lib/sportdb/models.rb +259 -0
  24. data/lib/sportdb/models/assoc.rb +106 -0
  25. data/lib/sportdb/models/assoc_assoc.rb +15 -0
  26. data/lib/sportdb/models/badge.rb +14 -0
  27. data/lib/sportdb/models/event.rb +65 -0
  28. data/lib/sportdb/models/event_ground.rb +15 -0
  29. data/lib/sportdb/models/event_team.rb +16 -0
  30. data/lib/sportdb/models/forward.rb +55 -0
  31. data/lib/sportdb/models/game.rb +244 -0
  32. data/lib/sportdb/models/goal.rb +15 -0
  33. data/lib/sportdb/models/ground.rb +100 -0
  34. data/lib/sportdb/models/group.rb +23 -0
  35. data/lib/sportdb/models/group_team.rb +14 -0
  36. data/lib/sportdb/models/league.rb +83 -0
  37. data/lib/sportdb/models/person.rb +21 -0
  38. data/lib/sportdb/models/roster.rb +18 -0
  39. data/lib/sportdb/models/round.rb +22 -0
  40. data/lib/sportdb/models/season.rb +14 -0
  41. data/lib/sportdb/models/stats/alltime_standing.rb +44 -0
  42. data/lib/sportdb/models/stats/alltime_standing_entry.rb +23 -0
  43. data/lib/sportdb/models/stats/event_standing.rb +55 -0
  44. data/lib/sportdb/models/stats/event_standing_entry.rb +21 -0
  45. data/lib/sportdb/models/stats/group_standing.rb +50 -0
  46. data/lib/sportdb/models/stats/group_standing_entry.rb +22 -0
  47. data/lib/sportdb/models/team.rb +119 -0
  48. data/lib/sportdb/models/team_comp.rb +64 -0
  49. data/lib/sportdb/models/utils.rb +78 -0
  50. data/lib/sportdb/models/world/city.rb +21 -0
  51. data/lib/sportdb/models/world/continent.rb +20 -0
  52. data/lib/sportdb/models/world/country.rb +19 -0
  53. data/lib/sportdb/models/world/region.rb +19 -0
  54. data/lib/sportdb/patterns.rb +38 -0
  55. data/lib/sportdb/reader.rb +130 -0
  56. data/lib/sportdb/reader_file.rb +123 -0
  57. data/lib/sportdb/reader_zip.rb +165 -0
  58. data/lib/sportdb/readers/assoc.rb +54 -0
  59. data/lib/sportdb/readers/event.rb +200 -0
  60. data/lib/sportdb/readers/game.rb +877 -0
  61. data/lib/sportdb/readers/ground.rb +53 -0
  62. data/lib/sportdb/readers/league.rb +54 -0
  63. data/lib/sportdb/readers/season.rb +83 -0
  64. data/lib/sportdb/readers/squad_club.rb +201 -0
  65. data/lib/sportdb/readers/squad_national_team.rb +173 -0
  66. data/lib/sportdb/readers/team.rb +53 -0
  67. data/lib/sportdb/schema.rb +373 -0
  68. data/lib/sportdb/standings.rb +178 -0
  69. data/lib/sportdb/stats.rb +27 -0
  70. data/lib/sportdb/utils.rb +89 -0
  71. data/lib/sportdb/utils_date.rb +26 -0
  72. data/lib/sportdb/utils_goals.rb +20 -0
  73. data/lib/sportdb/utils_group.rb +63 -0
  74. data/lib/sportdb/utils_map.rb +44 -0
  75. data/lib/sportdb/utils_round.rb +165 -0
  76. data/lib/sportdb/utils_scores.rb +17 -0
  77. data/lib/sportdb/utils_teams.rb +43 -0
  78. data/lib/sportdb/version.rb +23 -0
  79. data/test/data/at-austria/2013_14/bl.txt +227 -0
  80. data/test/data/at-austria/2013_14/bl.yml +30 -0
  81. data/test/data/at-austria/2013_14/bl_ii.txt +154 -0
  82. data/test/data/at-austria/2013_14/el.txt +4 -0
  83. data/test/data/at-austria/2013_14/el.yml +25 -0
  84. data/test/data/at-austria/2013_14/squads/austria.txt +40 -0
  85. data/test/data/at-austria/2013_14/squads/salzburg.txt +35 -0
  86. data/test/data/at-austria/leagues.txt +11 -0
  87. data/test/data/at-austria/teams.txt +75 -0
  88. data/test/data/at-austria/teams_2.txt +34 -0
  89. data/test/data/national-teams/assocs.txt +231 -0
  90. data/test/data/national-teams/europe/assocs.txt +13 -0
  91. data/test/data/national-teams/europe/teams.txt +13 -0
  92. data/test/data/national-teams/north-america/assocs.txt +10 -0
  93. data/test/data/national-teams/north-america/teams.txt +7 -0
  94. data/test/data/national-teams/teams.txt +19 -0
  95. data/test/data/players/europe/at-austria/players.txt +45 -0
  96. data/test/data/players/europe/de-deutschland/players.txt +41 -0
  97. data/test/data/players/south-america/br-brazil/players.txt +51 -0
  98. data/test/data/world-cup/1930/cup.txt +71 -0
  99. data/test/data/world-cup/1930/cup.yml +23 -0
  100. data/test/data/world-cup/1930/cup_goals.txt +47 -0
  101. data/test/data/world-cup/1930/cup_goals.yml +23 -0
  102. data/test/data/world-cup/1954/cup.txt +90 -0
  103. data/test/data/world-cup/1954/cup.yml +30 -0
  104. data/test/data/world-cup/1962/cup.txt +86 -0
  105. data/test/data/world-cup/1962/cup.yml +32 -0
  106. data/test/data/world-cup/1974/cup.yml +35 -0
  107. data/test/data/world-cup/1974/cup_finals.txt +14 -0
  108. data/test/data/world-cup/1974/cup_i.txt +55 -0
  109. data/test/data/world-cup/1974/cup_ii.txt +34 -0
  110. data/test/data/world-cup/2014/cup.txt +5 -0
  111. data/test/data/world-cup/2014/cup.yml +54 -0
  112. data/test/data/world-cup/2014/squads/br-brazil.txt +46 -0
  113. data/test/data/world-cup/2014/squads/de-deutschland.txt +8 -0
  114. data/test/data/world-cup/2014/squads/jp-japan.txt +30 -0
  115. data/test/data/world-cup/2014/squads/uy-uruguay.txt +32 -0
  116. data/test/data/world-cup/leagues.txt +5 -0
  117. data/test/data/world-cup/seasons_1930.txt +4 -0
  118. data/test/data/world-cup/seasons_1954.txt +4 -0
  119. data/test/data/world-cup/seasons_1962.txt +4 -0
  120. data/test/data/world-cup/seasons_1974.txt +5 -0
  121. data/test/data/world-cup/teams_1930.txt +26 -0
  122. data/test/data/world-cup/teams_1954.txt +30 -0
  123. data/test/data/world-cup/teams_1962.txt +29 -0
  124. data/test/data/world-cup/teams_1974.txt +29 -0
  125. data/test/helper.rb +120 -0
  126. data/test/test_assoc_reader.rb +201 -0
  127. data/test/test_changes.rb +74 -0
  128. data/test/test_cursor.rb +50 -0
  129. data/test/test_date.rb +100 -0
  130. data/test/test_goals.rb +109 -0
  131. data/test/test_lang.rb +130 -0
  132. data/test/test_load.rb +61 -0
  133. data/test/test_reader.rb +88 -0
  134. data/test/test_reader_from_string.rb +65 -0
  135. data/test/test_round_auto.rb +370 -0
  136. data/test/test_round_def.rb +109 -0
  137. data/test/test_round_header.rb +183 -0
  138. data/test/test_scores.rb +70 -0
  139. data/test/test_squad_club_reader.rb +76 -0
  140. data/test/test_squad_national_team_reader.rb +116 -0
  141. data/test/test_standings.rb +279 -0
  142. data/test/test_standings_ii.rb +46 -0
  143. data/test/test_utils.rb +124 -0
  144. data/test/test_winner.rb +95 -0
  145. metadata +378 -0
@@ -0,0 +1,27 @@
1
+
2
+ module SportDb
3
+
4
+ class Stats
5
+ include Models
6
+
7
+ def tables
8
+ puts " #{League.count} leagues / #{Season.count} seasons"
9
+ puts " #{Event.count} events (league+season recs) / #{Round.count} rounds / #{Group.count} groups"
10
+ puts " #{Team.count} teams"
11
+ puts " #{Game.count} games"
12
+ puts " #{Badge.count} badges"
13
+
14
+ puts " #{Roster.count} rosters (person+team+event recs)"
15
+ puts " #{Goal.count} goals (person+game recs)"
16
+
17
+ puts " #{Assoc.count} assocs|orgs"
18
+ puts " #{Ground.count} grounds|stadiums"
19
+
20
+ ## note: moved to racing.db -- remove/delete!!
21
+ ## puts " #{Track.count} tracks / #{Race.count} races (track+event recs) / #{Run.count} runs"
22
+ ## puts " #{Record.count} records (race|run+person recs)"
23
+ end
24
+
25
+ end # class Stats
26
+
27
+ end # module SportDb
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+
3
+ ### note: some utils moved to worldbdb/utils for reuse
4
+
5
+
6
+ ####
7
+ ## move to folder matcher(s)/finder(s)
8
+ # -- rename to FixtureFinder or FixtureFinders
9
+ # or just GeneralFinder
10
+ # TeamFinder etc. ???
11
+
12
+
13
+ module SportDb
14
+ module FixtureHelpers
15
+
16
+
17
+ def cut_off_end_of_line_comment!( line )
18
+ # cut off (that is, remove) optional end of line comment starting w/ #
19
+
20
+ line.sub!( /#.*$/ ) do |_|
21
+ logger.debug " cutting off end of line comment - >>#{$&}<<"
22
+ ''
23
+ end
24
+
25
+ # NB: line = line.sub will NOT work - thus, lets use line.sub!
26
+ end
27
+
28
+
29
+ def find_nationality!( line )
30
+ # extract optional nationality - three-letter country code from line e.g. Lionel Messi (ARG)
31
+ # and return it
32
+ # NB: side effect - removes num from line string
33
+
34
+ regex = /\(([A-Z]{3})\)/ # e.g. (ARG)
35
+ if line =~ regex
36
+ logger.debug " nationality: >#{$1}<"
37
+
38
+ line.sub!( regex, '[NATIONALITY]' )
39
+ return $1.to_s
40
+ else
41
+ return nil
42
+ end
43
+ end
44
+
45
+
46
+ def find_leading_num!( line )
47
+ # extract optional leading num from line e.g. 9 Lionel Messi
48
+ # and return it
49
+ # NB: side effect - removes num from line string
50
+
51
+ # e.g. 9 Lionel Messi - must start line
52
+ ## note: use lookahead (?=) for trailing spaces - do NOT cosume
53
+ regex = /^[ \t]*(\d{1,3})(?=[ \t]+)/
54
+ if line =~ regex
55
+ logger.debug " num: >#{$1}<"
56
+
57
+ line.sub!( regex, '[NUM]' )
58
+ return $1.to_i
59
+ else
60
+ return nil
61
+ end
62
+ end
63
+
64
+ def find_leading_pos!( line )
65
+ # extract optional game pos from line
66
+ # and return it
67
+ # NB: side effect - removes pos from line string
68
+
69
+ # e.g. (1) - must start line
70
+ regex = /^[ \t]*\((\d{1,3})\)[ \t]+/
71
+ if line =~ regex
72
+ logger.debug " pos: >#{$1}<"
73
+
74
+ line.sub!( regex, '[POS] ' ) # NB: add trailing space
75
+ return $1.to_i
76
+ else
77
+ return nil
78
+ end
79
+ end
80
+
81
+ def find_game_pos!( line )
82
+ ## fix: add depreciation warning - remove - use find_leading_pos!
83
+ find_leading_pos!( line )
84
+ end
85
+
86
+
87
+
88
+ end # module FixtureHelpers
89
+ end # module SportDb
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+ def is_postponed?( line )
7
+ # check if line include postponed marker e.g. =>
8
+ line =~ /=>/
9
+ end
10
+
11
+
12
+ def find_date!( line, opts={} )
13
+ ## NB: lets us pass in start_at/end_at date (for event)
14
+ # for auto-complete year
15
+
16
+ # extract date from line
17
+ # and return it
18
+ # NB: side effect - removes date from line string
19
+
20
+ finder = DateFinder.new
21
+ finder.find!( line, opts )
22
+ end
23
+
24
+ end # module FixtureHelpers
25
+ end # module SportDb
26
+
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+ def is_goals?( line )
7
+ # check if is goals line
8
+ # e.g. looks like
9
+ # Neymar 29', 71' (pen.) Oscar 90+1'; Marcelo 11' (o.g.)
10
+ # check for
11
+ # <space>90' or
12
+ # <space>90+1'
13
+
14
+ line =~ /[ ](\d{1,3}\+)?\d{1,3}'/
15
+ end
16
+
17
+
18
+ end # module FixtureHelpers
19
+ end # module SportDb
20
+
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+ def is_group_def?( line )
7
+ # NB: check after is_round? (round may contain group reference!)
8
+ ## must include bar (|) marker (make required)
9
+ line =~ /\|/ && is_group?( line )
10
+ end
11
+
12
+ def is_group?( line )
13
+ # NB: check after is_round? (round may contain group reference!)
14
+ ## note: =~ return nil if not match found, and 0,1, etc for match
15
+ (line =~ SportDb.lang.regex_group) != nil
16
+ end
17
+
18
+ def find_group_title_and_pos!( line )
19
+ ## group pos - for now support single digit e.g 1,2,3 or letter e.g. A,B,C or HEX
20
+ ## nb: (?:) = is for non-capturing group(ing)
21
+
22
+ ## fix:
23
+ ## get Group|Gruppe|Grupo from lang!!!! do NOT hardcode in place
24
+
25
+ ## todo:
26
+ ## check if Group A: or [Group A] works e.g. : or ] get matched by \b ???
27
+ regex = /(?:Group|Gruppe|Grupo)\s+((?:\d{1}|[A-Z]{1,3}))\b/
28
+
29
+ match = regex.match( line )
30
+
31
+ return [nil,nil] if match.nil?
32
+
33
+ pos = case match[1]
34
+ when 'A' then 1
35
+ when 'B' then 2
36
+ when 'C' then 3
37
+ when 'D' then 4
38
+ when 'E' then 5
39
+ when 'F' then 6
40
+ when 'G' then 7
41
+ when 'H' then 8
42
+ when 'I' then 9
43
+ when 'J' then 10
44
+ when 'K' then 11
45
+ when 'L' then 12
46
+ when 'HEX' then 666 # HEX for Hexagonal - todo/check: map to something else ??
47
+ else match[1].to_i
48
+ end
49
+
50
+ title = match[0]
51
+
52
+ logger.debug " title: >#{title}<"
53
+ logger.debug " pos: >#{pos}<"
54
+
55
+ line.sub!( regex, '[GROUP.TITLE+POS]' )
56
+
57
+ return [title,pos]
58
+ end
59
+
60
+
61
+
62
+ end # module FixtureHelpers
63
+ end # module SportDb
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+
7
+ def find_ground!( line )
8
+ TextUtils.find_key_for!( 'ground', line )
9
+ end
10
+
11
+ ## todo/fix: pass in known_grounds as a parameter? why? why not?
12
+ ### todo/fix:
13
+ ## remove =nil in para - make param required w/o fallback
14
+
15
+ def map_ground!( line, known_grounds=nil )
16
+ if known_grounds.nil?
17
+ puts "depreciated API call map_ground! (pass in mapping table as 2nd param)"
18
+ known_grounds = @known_grounds
19
+ end
20
+
21
+ TextUtils.map_titles_for!( 'ground', line, known_grounds )
22
+ end
23
+
24
+
25
+
26
+ def find_person!( line )
27
+ TextUtils.find_key_for!( 'person', line )
28
+ end
29
+
30
+ ### todo/fix:
31
+ ## remove =nil in para - make param required w/o fallback
32
+ def map_person!( line, known_persons=nil )
33
+ if known_persons.nil?
34
+ puts "depreciated API call map_person! (pass in mapping table as 2nd param)"
35
+ known_persons = @known_persons
36
+ end
37
+
38
+ TextUtils.map_titles_for!( 'person', line, known_persons )
39
+ end
40
+
41
+
42
+ end # module FixtureHelpers
43
+ end # module SportDb
44
+
@@ -0,0 +1,165 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+ def is_round_def?( line )
7
+ ## must include bar (|) marker (make required)
8
+ line =~ /\|/ && is_round?( line )
9
+ end
10
+
11
+ def is_round?( line )
12
+ ## note: =~ return nil if not match found, and 0,1, etc for match
13
+ (line =~ SportDb.lang.regex_round) != nil
14
+ end
15
+
16
+ def is_knockout_round?( line )
17
+
18
+ ## todo: check for adding ignore case for regex (e.g. 1st leg/1st Leg)
19
+
20
+ if line =~ SportDb.lang.regex_leg1
21
+ logger.debug " two leg knockout; skip knockout flag on first leg"
22
+ false
23
+ elsif line =~ SportDb.lang.regex_knockout_round
24
+ logger.debug " setting knockout flag to true"
25
+ true
26
+ elsif line =~ /K\.O\.|K\.o\.|Knockout/
27
+ ## NB: add two language independent markers, that is, K.O. and Knockout
28
+ logger.debug " setting knockout flag to true (lang independent marker)"
29
+ true
30
+ else
31
+ false
32
+ end
33
+ end
34
+
35
+
36
+ ##
37
+ ## fix/todo: check that [ROUND.TITLE2] and friends do NOT use pipes (|)
38
+ ## change all pipes (|) to dot (.)
39
+ ## - pipes get used for def markers!!!
40
+
41
+ def find_round_header_title2!( line )
42
+ ## todo/fix:
43
+ ## cleanup method
44
+ ## use buf.index( '//' ) to split string (see found_round_def)
45
+ ## why? simpler why not?
46
+ ## - do we currently allow groups if title2 present? add example if it works?
47
+
48
+
49
+ # assume everything after // is title2 - strip off leading n trailing whitespaces
50
+ regex = /\/{2,}\s*(.+)\s*$/
51
+ if line =~ regex
52
+ logger.debug " title2: >#{$1}<"
53
+
54
+ line.sub!( regex, '[ROUND.TITLE2]' )
55
+ return $1
56
+ else
57
+ return nil # no round title2 found (title2 is optional)
58
+ end
59
+ end
60
+
61
+
62
+ def find_round_header_title!( line )
63
+ # assume everything left is the round title
64
+ # extract all other items first (round title2, round pos, group title n pos, etc.)
65
+
66
+ ## todo/fix:
67
+ ## cleanup method
68
+ ## use buf.index( '//' ) to split string (see found_round_def)
69
+ ## why? simpler why not?
70
+ ## - do we currently allow groups if title2 present? add example if it works?
71
+
72
+ buf = line.dup
73
+ logger.debug " find_round_header_title! line-before: >>#{buf}<<"
74
+
75
+ buf.gsub!( /\[[^\]]+\]/, '' ) # e.g. remove [ROUND.POS], [ROUND.TITLE2], [GROUP.TITLE+POS] etc.
76
+ buf.sub!( /\s+[\/\-]{1,}\s+$/, '' ) # remove optional trailing / or / chars (left over from group)
77
+ buf.strip! # remove leading and trailing whitespace
78
+
79
+ logger.debug " find_round_title! line-after: >>#{buf}<<"
80
+
81
+ ### bingo - assume what's left is the round title
82
+
83
+ logger.debug " title: >>#{buf}<<"
84
+ line.sub!( buf, '[ROUND.TITLE]' )
85
+
86
+ buf
87
+ end
88
+
89
+
90
+ def find_round_def_title!( line )
91
+ # assume everything before pipe (\) is the round title
92
+ # strip [ROUND.POS], todo:?? [ROUND.TITLE2]
93
+
94
+ # todo/fix: add title2 w/ // or / why? why not?
95
+ # -- strip / or / chars
96
+
97
+ buf = line.dup
98
+ logger.debug " find_round_def_title! line-before: >>#{buf}<<"
99
+
100
+ ## cut-off everything after (including) pipe (|)
101
+ buf = buf[ 0...buf.index('|') ]
102
+
103
+ # e.g. remove [ROUND.POS], [ROUND.TITLE2], [GROUP.TITLE+POS] etc.
104
+ buf.gsub!( /\[[^\]]+\]/, '' ) ## fix: use helper for (re)use e.g. remove_match_placeholder/marker or similar?
105
+ # remove leading and trailing whitespace
106
+ buf.strip!
107
+
108
+ logger.debug " find_round_def_title! line-after: >>#{buf}<<"
109
+
110
+ logger.debug " title: >>#{buf}<<"
111
+ line.sub!( buf, '[ROUND.TITLE]' )
112
+
113
+ buf
114
+ end
115
+
116
+
117
+ def find_round_pos!( line )
118
+ # pass #1) extract optional round pos from line
119
+ # e.g. (1) - must start line
120
+ regex_pos = /^[ \t]*\((\d{1,3})\)[ \t]+/
121
+
122
+ # pass #2) find free standing number e.g. Matchday 3 or Round 5 or 3. Spieltag etc.
123
+ # note: /\b(\d{1,3})\b/
124
+ # will match -12
125
+ # thus, use space required - will NOT match -2 e.g. Group-2 Play-off
126
+ # note: allow 1. Runde n
127
+ # 1^ Giornata
128
+ regex_num = /(?:^|\s)(\d{1,3})(?:[.\^\s]|$)/
129
+
130
+ if line =~ regex_pos
131
+ logger.debug " pos: >#{$1}<"
132
+
133
+ line.sub!( regex_pos, '[ROUND.POS] ' ) ## NB: add back trailing space that got swallowed w/ regex -> [ \t]+
134
+ return $1.to_i
135
+ elsif line =~ regex_num
136
+ ## assume number in title is pos (e.g. Jornada 3, 3 Runde etc.)
137
+ ## NB: do NOT remove pos from string (will get removed by round title)
138
+
139
+ num = $1.to_i # note: clone capture; keep a copy (another regex follows; will redefine $1)
140
+
141
+ #### fix:
142
+ # use/make keywords required
143
+ # e.g. Round of 16 -> should NOT match 16!
144
+ # Spiel um Platz 3 (or 5) etc -> should NOT match 3!
145
+ # Round 16 - ok
146
+ # thus, check for required keywords
147
+
148
+ ## quick hack for round of 16
149
+ # todo: mask match e.g. Round of xxx ... and try again - might include something
150
+ # reuse pattern for Group XX Replays for example
151
+ if line =~ /^\s*Round of \d{1,3}\b/
152
+ return nil
153
+ end
154
+
155
+ logger.debug " pos: >#{num}<"
156
+ return num
157
+ else
158
+ ## fix: add logger.warn no round pos found in line
159
+ return nil
160
+ end
161
+ end # method find_round_pos!
162
+
163
+
164
+ end # module FixtureHelpers
165
+ end # module SportDb
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module FixtureHelpers
5
+
6
+
7
+ def find_scores!( line, opts={} )
8
+ # note: always call after find_dates !!!
9
+ # scores match date-like patterns!! e.g. 10-11 or 10:00 etc.
10
+ # -- note: score might have two digits too
11
+
12
+ finder = ScoresFinder.new
13
+ finder.find!( line, opts )
14
+ end
15
+
16
+ end # module FixtureHelpers
17
+ end # module SportDb