sportdb-config 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sportdb/config/team_reader.rb +16 -1
- data/lib/sportdb/config/version.rb +1 -1
- data/test/test_team_reader.rb +30 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 955375833b909f386106aedfc6726b15454819dc
|
4
|
+
data.tar.gz: 82508fd16aa4c60a4e9654aaaa604ed71d3494d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa819f096e961388cb7fa5ef0627d2fb754ccba38d4c598023c5179cb687b8fb298a033e9af0ec4b502e78d2b64c1bed370cda41411d7cac2703300860b140f
|
7
|
+
data.tar.gz: b03b985e5ec0ac0caf36adef463c30cccdb16b245365889f16ad8d67fcf2fa8ee446c1ce7ca6296678382cad547beb25a0adc2df402c63d456cae9527d4fd2fa
|
@@ -24,6 +24,7 @@ class Team
|
|
24
24
|
|
25
25
|
def initialize
|
26
26
|
@alt_names = []
|
27
|
+
@year_end = nil
|
27
28
|
end
|
28
29
|
|
29
30
|
|
@@ -55,7 +56,21 @@ def self.parse( txt )
|
|
55
56
|
pp line
|
56
57
|
|
57
58
|
|
58
|
-
if line.
|
59
|
+
next if line =~ /^={1,}$/ ## skip "decorative" only heading e.g. ========
|
60
|
+
|
61
|
+
## note: like in wikimedia markup (and markdown) all optional trailing ==== too
|
62
|
+
## todo/check: allow === Text =-=-=-=-=-= too - why? why not?
|
63
|
+
if line =~ /^(={1,}) ## leading ======
|
64
|
+
([^=]+?) ## text (note: for now no "inline" = allowed)
|
65
|
+
=* ## (optional) trailing ====
|
66
|
+
$/x
|
67
|
+
heading_marker = $1
|
68
|
+
heading_level = $1.length ## count number of = for heading level
|
69
|
+
heading = $2.strip
|
70
|
+
|
71
|
+
puts "heading #{heading_level} >#{heading}<"
|
72
|
+
## skip heading for now
|
73
|
+
elsif line.start_with?( '|' )
|
59
74
|
## assume continuation with line of alternative names
|
60
75
|
## note: skip leading pipe
|
61
76
|
values = line[1..-1].split( '|' ) # team names - allow/use pipe(|)
|
data/test/test_team_reader.rb
CHANGED
@@ -11,8 +11,8 @@ class TestTeamReader < MiniTest::Test
|
|
11
11
|
|
12
12
|
def test_parse_at
|
13
13
|
recs = SportDb::Import::TeamReader.parse( <<TXT )
|
14
|
-
|
15
|
-
|
14
|
+
==================================
|
15
|
+
= Austria (at)
|
16
16
|
|
17
17
|
FK Austria Wien, Wien
|
18
18
|
| Austria Vienna | Austria Wien
|
@@ -30,7 +30,10 @@ TXT
|
|
30
30
|
|
31
31
|
def test_parse_us
|
32
32
|
recs = SportDb::Import::TeamReader.parse( <<TXT )
|
33
|
-
|
33
|
+
==================================================
|
34
|
+
= United States (us)
|
35
|
+
|
36
|
+
#######################################
|
34
37
|
# Major League Soccer (MLS) teams
|
35
38
|
|
36
39
|
Atlanta United FC, 2017, Atlanta › Georgia
|
@@ -81,7 +84,7 @@ TXT
|
|
81
84
|
|
82
85
|
def test_parse_geos
|
83
86
|
recs = SportDb::Import::TeamReader.parse( <<TXT )
|
84
|
-
|
87
|
+
|
85
88
|
Fulham FC, 1879, @ Craven Cottage, London (Fulham) › Greater London
|
86
89
|
| Fulham | FC Fulham
|
87
90
|
Charlton Athletic FC, @ The Valley, London (Charlton) › Greater London
|
@@ -104,4 +107,27 @@ TXT
|
|
104
107
|
assert_equal 'Hamburg', recs[2].city
|
105
108
|
assert_equal 'St. Pauli', recs[2].district
|
106
109
|
end
|
110
|
+
|
111
|
+
|
112
|
+
def test_parse_headings
|
113
|
+
recs = SportDb::Import::TeamReader.parse( <<TXT )
|
114
|
+
==============
|
115
|
+
====
|
116
|
+
===========
|
117
|
+
= Heading 1
|
118
|
+
= Heading 1 ==================
|
119
|
+
== Heading 2
|
120
|
+
== Heading 2 =========
|
121
|
+
=== Heading 3
|
122
|
+
=== Heading 3 ===============
|
123
|
+
=== Heading 3 # with end-of-line comment
|
124
|
+
=== Heading 3 ## with end-of-line comment
|
125
|
+
=== Heading 3 ========= # with end-of-line comment
|
126
|
+
TXT
|
127
|
+
|
128
|
+
pp recs
|
129
|
+
|
130
|
+
assert_equal 0, recs.size
|
131
|
+
end
|
132
|
+
|
107
133
|
end # class TestTeamReader
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
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-07-
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|