cricinfo 0.0.2 → 0.0.3
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.
- data/History.txt +4 -0
- data/bin/cricinfo +1 -1
- data/lib/cricinfo/scores.rb +2 -2
- data/lib/cricinfo.rb +1 -1
- data/spec/cricinfo_scores_spec.rb +20 -0
- metadata +25 -9
data/History.txt
CHANGED
data/bin/cricinfo
CHANGED
data/lib/cricinfo/scores.rb
CHANGED
@@ -7,11 +7,11 @@ module CricInfo
|
|
7
7
|
SCORES_PATH = "/s/2497/Scores"
|
8
8
|
|
9
9
|
# match name, team1, team2, inningsdata, start_time
|
10
|
-
RE_MATCH = /matchId=.*?">(
|
10
|
+
RE_MATCH = /matchId=.*?">([^:]+):\s*(.*?)\s+v\s+(.*?)<\/a>.*?<\/tr>(.*?)<\/tr>(.*?Start time (.*?)\s*<\/b>)?/
|
11
11
|
|
12
12
|
# team1/2, i1runs, i1wickets, i1decl, i2wickets, i2decl, overs
|
13
13
|
# (overs optional)
|
14
|
-
RE_INNINGS = /<b>\s*(
|
14
|
+
RE_INNINGS = /<b>\s*(.*?)\s*<\/b>\s*<b>\s*(\d+)(?:\/(\d+))?(d)?(?:\s*&\s*(\d+)\/(\d+)(d)?)?\s*(?:\(([\d\.]+))?/
|
15
15
|
|
16
16
|
# start_time (e.g. Start time 09:30 GMT)
|
17
17
|
RE_START = /<b>\s*Start\s+time\s+(.*?)\s*<\/b>/
|
data/lib/cricinfo.rb
CHANGED
@@ -99,6 +99,26 @@ describe CricInfo::Scores do
|
|
99
99
|
game.inns4.team.should == "BAN"
|
100
100
|
end
|
101
101
|
|
102
|
+
# Scores8.html
|
103
|
+
# (team with space in the name)
|
104
|
+
|
105
|
+
it "should initialize and parse score data 8" do
|
106
|
+
CricInfo::Scores.should_receive(:fetch_score_data).and_return(fixture(8))
|
107
|
+
c = CricInfo::Scores.new
|
108
|
+
c.should_not be_nil
|
109
|
+
|
110
|
+
c.games.length.should == 3
|
111
|
+
game = c.games[1] # LIONS v SOUTH AUST
|
112
|
+
game.innings.length.should == 1
|
113
|
+
|
114
|
+
game.team1.should == "LIONS"
|
115
|
+
game.team2.should == "SOUTH AUST"
|
116
|
+
game.inns1.team.should == "SOUTH AUST"
|
117
|
+
game.inns1.runs.should == 165
|
118
|
+
game.inns1.wickets.should == 4
|
119
|
+
end
|
120
|
+
|
121
|
+
|
102
122
|
private
|
103
123
|
|
104
124
|
def fixture(number)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cricinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew S Williams
|
@@ -15,25 +15,41 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-12 00:00:00 +09:30
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: rubyforge
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 7
|
30
30
|
segments:
|
31
31
|
- 2
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 2.
|
32
|
+
- 0
|
33
|
+
- 4
|
34
|
+
version: 2.0.4
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 21
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 6
|
49
|
+
- 1
|
50
|
+
version: 2.6.1
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
37
53
|
description: An interface to cricinfo.com game data (current games only).
|
38
54
|
email:
|
39
55
|
- sobakasu@gmail.com
|