mlb_gameday 0.1.4 → 0.1.5
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 +4 -4
- data/lib/mlb_gameday/game.rb +15 -1
- data/lib/mlb_gameday/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: acc1fb578a43fe4149652f4b576bf4a2f558a5ee
|
|
4
|
+
data.tar.gz: 8c3bd85a6e397cf7b40415dc78d9e653b1300583
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e89367c19db7e62f17b492e0c25ca79d804068193663696be03fee22b837fcc0e452846a587b3217bfc556eeceab8c7081338a5590a73de7d172b18cb2c1fb02
|
|
7
|
+
data.tar.gz: 7d83a27c4ad86ba0f57c356a4979d981e9078638c1a8041305cdc56d6ffbe7974efc9594591ec00a68e748bdd242b7ad92610463a5d5d360eb6834d9150018f7
|
data/lib/mlb_gameday/game.rb
CHANGED
|
@@ -57,12 +57,14 @@ module MLBGameday
|
|
|
57
57
|
|
|
58
58
|
# Preview, Pre-Game, In Progress, Final
|
|
59
59
|
def status
|
|
60
|
+
return 'Preview' unless @linescore
|
|
61
|
+
|
|
60
62
|
@status ||= @linescore.xpath('//game/@status').text
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
# [3, Top/Middle/Bottom/End]
|
|
64
66
|
def inning
|
|
65
|
-
return [0, '?'] unless @linescore.xpath('//game/@inning')
|
|
67
|
+
return [0, '?'] unless @linescore && @linescore.xpath('//game/@inning')
|
|
66
68
|
|
|
67
69
|
[@linescore.xpath('//game/@inning').text.to_i,
|
|
68
70
|
@linescore.xpath('//game/@inning_state').text]
|
|
@@ -92,11 +94,15 @@ module MLBGameday
|
|
|
92
94
|
end
|
|
93
95
|
|
|
94
96
|
def home_record
|
|
97
|
+
return [0, 0] unless @linescore
|
|
98
|
+
|
|
95
99
|
[@linescore.xpath('//game/@home_win'),
|
|
96
100
|
@linescore.xpath('//game/@home_loss')].map(&:text).map(&:to_i)
|
|
97
101
|
end
|
|
98
102
|
|
|
99
103
|
def away_record
|
|
104
|
+
return [0, 0] unless @linescore
|
|
105
|
+
|
|
100
106
|
[@linescore.xpath('//game/@away_win'),
|
|
101
107
|
@linescore.xpath('//game/@away_loss')].map(&:text).map(&:to_i)
|
|
102
108
|
end
|
|
@@ -137,10 +143,14 @@ module MLBGameday
|
|
|
137
143
|
end
|
|
138
144
|
|
|
139
145
|
def away_starting_pitcher
|
|
146
|
+
return '' unless @linescore
|
|
147
|
+
|
|
140
148
|
@linescore.xpath('//game/away_probable_pitcher/@id').text
|
|
141
149
|
end
|
|
142
150
|
|
|
143
151
|
def home_starting_pitcher
|
|
152
|
+
return '' unless @linescore
|
|
153
|
+
|
|
144
154
|
@linescore.xpath('//game/home_probable_pitcher/@id').text
|
|
145
155
|
end
|
|
146
156
|
|
|
@@ -216,10 +226,14 @@ module MLBGameday
|
|
|
216
226
|
end
|
|
217
227
|
|
|
218
228
|
def free?
|
|
229
|
+
return false unless @linescore
|
|
230
|
+
|
|
219
231
|
@linescore.xpath('//game/game_media/media/@free').text == 'ALL'
|
|
220
232
|
end
|
|
221
233
|
|
|
222
234
|
def date
|
|
235
|
+
return Date.today unless @linescore # SUPER KLUDGE
|
|
236
|
+
|
|
223
237
|
@date ||= Chronic.parse @linescore.xpath('//game/@original_date').text
|
|
224
238
|
end
|
|
225
239
|
|
data/lib/mlb_gameday/version.rb
CHANGED