mlb_gameday 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6299f9b1205eaae985a66b13126e039e155a65c0
4
- data.tar.gz: a6e7728f34e670cf8622430443126ee51049ed0d
3
+ metadata.gz: acc1fb578a43fe4149652f4b576bf4a2f558a5ee
4
+ data.tar.gz: 8c3bd85a6e397cf7b40415dc78d9e653b1300583
5
5
  SHA512:
6
- metadata.gz: 5d68b8ba4599172fd4a5778bf3b905a3ed9bfb7cb74159a112fe7b4810ade98c3e15dfe750662e028292d822b7c4d43df8a400e30c6f81f0e7f99e6d61c8485a
7
- data.tar.gz: 696090f7753d5611090a935709c12d3263c6cb889fd1a23db33127057ac9734d6b1eb0c82801308a909c34252c83e061ffe20c607311c57c78f89deaa3c66ed0
6
+ metadata.gz: e89367c19db7e62f17b492e0c25ca79d804068193663696be03fee22b837fcc0e452846a587b3217bfc556eeceab8c7081338a5590a73de7d172b18cb2c1fb02
7
+ data.tar.gz: 7d83a27c4ad86ba0f57c356a4979d981e9078638c1a8041305cdc56d6ffbe7974efc9594591ec00a68e748bdd242b7ad92610463a5d5d360eb6834d9150018f7
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module MLBGameday
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlb_gameday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Hoffman