sportdb-readers 0.2.0 → 0.2.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: 065c28caeef803aeb7d27a41dbd4d552265975c7
4
- data.tar.gz: 5324561f854b1831397fc17254d861044a23b95d
3
+ metadata.gz: b34ccb4d608b438478b0d909f5dad9e5f4807677
4
+ data.tar.gz: bb1641c9eb65feebd42fbbecb9b3430c0b6c69ff
5
5
  SHA512:
6
- metadata.gz: 809e28ed7c09f28c6610de3f02650c265b29f39ac5dec03d12ae3ab31476b917a91315b8fc8554b2e97bcde2016deb41ea9d912915749e4d8255c0143250ccdf
7
- data.tar.gz: 4a1b726b10f56c25fe10ca94803601b351d1085dd7c0608ee6b5e2efd7841e90d70a2db15a0b0ce26595f0a3656a0ef0fc7d6587f767b7c4b5329902283f3ca1
6
+ metadata.gz: 269f51e9317a5762304ca0e36b9454a47a88e4cf6b7935690e6c2351c475ecfe7a24dffb1ac546af1f8925d3c7173cfb67373d7e46cd0b54923dcdedd8428f8c
7
+ data.tar.gz: 1e908059a559669c4a8a15ae6c88778c2b9c4f07e2badb1a3dc1a595d3b58c15ee35c5bd57054859afce2e32da356108035b9be926a7d1274cc277d857e3e0a3
@@ -5,10 +5,10 @@ module SportDb
5
5
  class MatchParserSimpleV2 ## simple match parser for club match schedules
6
6
  include LogUtils::Logging
7
7
 
8
- def initialize( lines, teams, start_at )
8
+ def initialize( lines, teams, start )
9
9
  @lines = lines ## todo/check: change to text instead of array of lines - why? why not?
10
10
  @mapper_teams = TeamMapper.new( teams )
11
- @start_at = start_at
11
+ @start = start
12
12
 
13
13
  ## build lookup hash by (team) key
14
14
  @teams = teams.reduce({}) { |h,team| h[team.key]=team; h }
@@ -241,7 +241,7 @@ class MatchParserSimpleV2 ## simple match parser for club match schedules
241
241
 
242
242
  ## pos = find_game_pos!( line )
243
243
 
244
- date = find_date!( line, start_at: @start_at )
244
+ date = find_date!( line, start: @start )
245
245
 
246
246
  ###
247
247
  # check if date found?
@@ -422,18 +422,17 @@ class MatchParserSimpleV2 ## simple match parser for club match schedules
422
422
  parse_date_header( line.dup )
423
423
  end
424
424
 
425
- def find_date!( line, opts={} )
425
+ def find_date!( line, start: )
426
426
  ## NB: lets us pass in start_at/end_at date (for event)
427
427
  # for auto-complete year
428
428
 
429
429
  # extract date from line
430
430
  # and return it
431
431
  # NB: side effect - removes date from line string
432
-
433
- finder = DateFinder.new
434
- finder.find!( line, opts )
432
+ DateFormats.find!( line, start: start )
435
433
  end
436
434
 
435
+
437
436
  def parse_date_header( line )
438
437
  # note: returns true if parsed, false if no match
439
438
 
@@ -447,7 +446,7 @@ class MatchParserSimpleV2 ## simple match parser for club match schedules
447
446
  team1_key = team_keys[0]
448
447
  team2_key = team_keys[1]
449
448
 
450
- date = find_date!( line, start_at: @start_at )
449
+ date = find_date!( line, start: @start )
451
450
 
452
451
  if date && team1_key.nil? && team2_key.nil?
453
452
  logger.debug( "date header line found: >#{line}<")
@@ -28,8 +28,16 @@ class MatchReaderV2 ## todo/check: rename to MatchReaderV2 (use plural?) why?
28
28
  ## hack for now: switch lang
29
29
  if ['at', 'de'].include?( league.country.key )
30
30
  SportDb.lang.lang = 'de'
31
+ DateFormats.lang = 'de'
32
+ elsif ['fr'].include?( league.country.key )
33
+ SportDb.lang.lang = 'fr'
34
+ DateFormats.lang = 'fr'
35
+ elsif ['es'].include?( league.country.key )
36
+ SportDb.lang.lang = 'es'
37
+ DateFormats.lang = 'es'
31
38
  else
32
39
  SportDb.lang.lang = 'en'
40
+ DateFormats.lang = 'en'
33
41
  end
34
42
 
35
43
  ## todo/fix: set lang for now depending on league country!!!
@@ -6,7 +6,7 @@ module Readers
6
6
 
7
7
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
8
8
  MINOR = 2
9
- PATCH = 0
9
+ PATCH = 1
10
10
  VERSION = [MAJOR,MINOR,PATCH].join('.')
11
11
 
12
12
  def self.version
@@ -96,10 +96,10 @@ TXT
96
96
  lines = txt.split( /\n+/ ) # note: removes/strips empty lines
97
97
  pp lines
98
98
 
99
- start_at= Date.new( 2017, 7, 1 )
99
+ start = Date.new( 2017, 7, 1 )
100
100
 
101
-
102
- parser = SportDb::MatchParserSimpleV2.new( lines, clubs, start_at )
101
+ DateFormats.lang = 'en'
102
+ parser = SportDb::MatchParserSimpleV2.new( lines, clubs, start )
103
103
  rounds, matches = parser.parse
104
104
  pp rounds
105
105
  pp matches
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-readers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2019-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-config