sportdb-formats 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 216e15369403af5707b3d2c6d82fcd6c72e2712d
4
- data.tar.gz: 5c73e0e7ce7309b2c8fb86e38d90d1d566f80688
3
+ metadata.gz: 4cdd2bc410771494ed506a24d384ca3c8b1c9684
4
+ data.tar.gz: 066f5288da503a00efe280369f57d6cd65bf4bf7
5
5
  SHA512:
6
- metadata.gz: 8033e4db4d7b047b37ec8b3be61657d15df72b7a6c6295317ca8c9cd19c0f578f2ecd75c25cf11b0dcb9218c1ff3e8d2a8e0efb0c59ae235b568b353ef55c9d6
7
- data.tar.gz: e5b510b45d4c28c6d83d6baa43ef954e78ae64af116c8305a983b5c54d2fda486425a793b48c8332dcf8cf5c441da37f7183602d50a7e07066049995b5940f0f
6
+ metadata.gz: f61edee9495047fc49dfb5720c7afc1e0e316e5fab024d8fc0b1bd5fcdad70524f6e22d24d8fad0aa679380565e0a0c7e36fae79c170655f8a7a496dee170aca
7
+ data.tar.gz: b378202d2c8152ac46386618d3c69c03d802b1439e74175f8d84fad304ce111edb0bb1cd848fc969848ce55e0cf8de15a46bec322351d5d199652ed16d41b164
@@ -100,6 +100,9 @@ module SportDb
100
100
  ## optional headers - note: find_header returns nil if header NOT found
101
101
  header_stage = find_header( headers, ['Stage'] )
102
102
  headers_mapping[:stage] = header_stage if header_stage
103
+
104
+ header_league = find_header( headers, ['League'] )
105
+ headers_mapping[:league] = header_league if header_league
103
106
  else
104
107
  ## else try footballdata.uk and others
105
108
  headers_mapping[:team1] = find_header( headers, ['HomeTeam', 'HT', 'Home'] )
@@ -290,13 +293,17 @@ module SportDb
290
293
  end
291
294
  end
292
295
 
296
+ league = nil
297
+ league = row[ headers_mapping[ :league ]] if headers_mapping[ :league ]
298
+
293
299
 
294
300
  match = Import::Match.new( date: date,
295
301
  team1: team1, team2: team2,
296
302
  score1: score1, score2: score2,
297
303
  score1i: score1i, score2i: score2i,
298
304
  round: round,
299
- stage: stage )
305
+ stage: stage,
306
+ league: league )
300
307
  matches << match
301
308
  end
302
309
 
@@ -73,6 +73,10 @@ module SportDb
73
73
  /[a-z0-9_.-]+\.csv$ ## note: allow dot (.) too e.g /eng.1.csv
74
74
  }x
75
75
 
76
+ ### add "generic" pattern to find all csv datafiles
77
+ CSV_RE = %r{ (?: ^|/ )
78
+ [a-z0-9_.-]+\.csv$ ## note: allow dot (.) too e.g /eng.1.csv
79
+ }x
76
80
 
77
81
 
78
82
  ## move class-level "static" finders to DirPackage (do NOT work for now for zip packages) - why? why not?
@@ -118,6 +122,7 @@ module SportDb
118
122
  end
119
123
  ## add match_match and match_match_csv - why? why not?
120
124
 
125
+
121
126
  class << self
122
127
  alias_method :match_teams?, :match_teams
123
128
  alias_method :teams?, :match_teams
@@ -212,6 +217,8 @@ module SportDb
212
217
  end
213
218
  end
214
219
  def each_match_csv( &blk ) each( pattern: MATCH_CSV_RE, &blk ); end
220
+ def each_csv( &blk ) each( pattern: CSV_RE, &blk ); end
221
+
215
222
  def each_club_props( &blk ) each( pattern: CLUB_PROPS_RE, &blk ); end
216
223
 
217
224
  def each_leagues( &blk ) each( pattern: LEAGUES_RE, &blk ); end
@@ -20,7 +20,8 @@ class Match
20
20
  :group,
21
21
  :conf1, :conf2, ## special case for mls e.g. conference1, conference2 (e.g. west, east, central)
22
22
  :country1, :country2, ## special case for champions league etc. - uses FIFA country code
23
- :comments
23
+ :comments,
24
+ :league ## (optinal) added as text for now (use struct?)
24
25
 
25
26
  def initialize( **kwargs )
26
27
  update( kwargs ) unless kwargs.empty?
@@ -47,6 +48,9 @@ class Match
47
48
  @group = kwargs[:group] if kwargs.has_key? :group
48
49
  @comments = kwargs[:comments] if kwargs.has_key? :comments
49
50
 
51
+ @league = kwargs[:league] if kwargs.has_key? :league
52
+
53
+
50
54
  if kwargs.has_key?( :score ) ## check all-in-one score struct for convenience!!!
51
55
  score = kwargs[:score]
52
56
  if score.nil? ## reset all score attribs to nil!!
@@ -7,7 +7,7 @@ module Formats
7
7
 
8
8
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
9
9
  MINOR = 1
10
- PATCH = 0
10
+ PATCH = 1
11
11
  VERSION = [MAJOR,MINOR,PATCH].join('.')
12
12
 
13
13
  def self.version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-formats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer