gatherer 0.0.4 → 0.0.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.
@@ -32,6 +32,7 @@ module Gatherer
32
32
 
33
33
  def extract_title
34
34
  row = document.css(SELECTORS[:title])
35
+ return '' unless row
35
36
  title_line = row.css('div.value').text
36
37
  end
37
38
 
@@ -41,6 +42,7 @@ module Gatherer
41
42
 
42
43
  def extract_types
43
44
  row = document.css(SELECTORS[:types])
45
+ return '' unless row
44
46
  type_line = row.css('div.value').text
45
47
  end
46
48
 
@@ -50,6 +52,7 @@ module Gatherer
50
52
 
51
53
  def extract_converted_mana_cost
52
54
  row = document.css(SELECTORS[:cmc])
55
+ return '' unless row
53
56
  cmc_line = row.css('div.value').text
54
57
  end
55
58
 
@@ -60,6 +63,7 @@ module Gatherer
60
63
 
61
64
  def extract_mana_cost
62
65
  row = document.css(SELECTORS[:mana])
66
+ return '' unless row
63
67
  mana_cost_line = row.css('div.value').css('img').map { |img| img['alt'] }
64
68
  end
65
69
 
@@ -73,6 +77,7 @@ module Gatherer
73
77
 
74
78
  def extract_subtypes
75
79
  row = document.css(SELECTORS[:subtypes])
80
+ return '' unless row
76
81
  row.css('div.value').text
77
82
  end
78
83
 
@@ -82,6 +87,7 @@ module Gatherer
82
87
 
83
88
  def extract_text
84
89
  row = document.css(SELECTORS[:text]).first
90
+ return '' unless row
85
91
  row.inner_html = replace_mana_symbols(row.inner_html)
86
92
  row.css('div.value div.cardtextbox').map(&:text)
87
93
  end
@@ -100,6 +106,7 @@ module Gatherer
100
106
 
101
107
  def extract_flavor_text
102
108
  row = document.css(SELECTORS[:flavor_text])
109
+ return '' unless row
103
110
  row.css('div.cardtextbox').text
104
111
  end
105
112
 
@@ -134,6 +141,7 @@ module Gatherer
134
141
 
135
142
  def extract_current_printing
136
143
  row = document.css(SELECTORS[:set])
144
+ return '' unless row
137
145
  row.css('img').map { |img| img['title'] }.first
138
146
  end
139
147
 
@@ -148,6 +156,7 @@ module Gatherer
148
156
 
149
157
  def extract_other_printings
150
158
  row = document.css(SELECTORS[:other_sets])
159
+ return '' unless row
151
160
  row.css('img').map { |img| img['title'] }
152
161
  end
153
162
 
@@ -158,6 +167,7 @@ module Gatherer
158
167
 
159
168
  def extract_abbreviation(title)
160
169
  images = document.css(SELECTORS[:set]).css('img')
170
+ return '' unless images
161
171
  images += document.css(SELECTORS[:other_sets]).css('img')
162
172
 
163
173
  images.map do |image|
@@ -175,6 +185,7 @@ module Gatherer
175
185
 
176
186
  def extract_power_toughness
177
187
  row = document.css(SELECTORS[:pt])
188
+ return '' unless row
178
189
  row.css('div.value').text
179
190
  end
180
191
 
@@ -191,6 +202,7 @@ module Gatherer
191
202
 
192
203
  def extract_number
193
204
  row = document.css(SELECTORS[:number])
205
+ return '' unless row
194
206
  row.css('div.value').text
195
207
  end
196
208
 
@@ -200,6 +212,7 @@ module Gatherer
200
212
 
201
213
  def extract_illustrator
202
214
  row = document.css(SELECTORS[:illustrator])
215
+ return '' unless row
203
216
  row.css('div.value').text
204
217
  end
205
218
 
@@ -1,3 +1,3 @@
1
1
  module Gatherer
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gatherer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty