Class: ScraperWiki::API::Matchers::LastRunMatcher
Instance Method Summary
collapse
Instance Method Details
#days ⇒ Object
Also known as:
day
188
189
190
191
|
# File 'lib/scraperwiki-api/matchers.rb', line 188
def days
@multiplier = 86400
self
end
|
#failure_message ⇒ Object
223
224
225
|
# File 'lib/scraperwiki-api/matchers.rb', line 223
def failure_message
"expected #{@actual['short_name']} to have run within #{span} seconds"
end
|
#hours ⇒ Object
Also known as:
hour
194
195
196
197
|
# File 'lib/scraperwiki-api/matchers.rb', line 194
def hours
@multiplier = 3600
self
end
|
#matches?(actual) ⇒ Boolean
TODO:
+last_run+ seems to follow British Summer Time, in which case it
will be +00, not +01, for part of the year.
214
215
216
217
|
# File 'lib/scraperwiki-api/matchers.rb', line 214
def matches?(actual)
super
Time.now - Time.parse("#{@actual['last_run']}+01") < span
end
|
#minutes ⇒ Object
Also known as:
minute
200
201
202
203
|
# File 'lib/scraperwiki-api/matchers.rb', line 200
def minutes
@multiplier = 60
self
end
|
#months ⇒ Object
Also known as:
month
176
177
178
179
|
# File 'lib/scraperwiki-api/matchers.rb', line 176
def months
@multiplier = 2592000 self
end
|
#negative_failure_message ⇒ Object
227
228
229
|
# File 'lib/scraperwiki-api/matchers.rb', line 227
def negative_failure_message
"expected #{@actual['short_name']} to not have run within #{span} seconds"
end
|
#seconds ⇒ Object
Also known as:
second
206
207
208
209
|
# File 'lib/scraperwiki-api/matchers.rb', line 206
def seconds
@multiplier = 3600
self
end
|
#span ⇒ Object
219
220
221
|
# File 'lib/scraperwiki-api/matchers.rb', line 219
def span
@expected * (@multiplier || 1)
end
|
#weeks ⇒ Object
Also known as:
week
182
183
184
185
|
# File 'lib/scraperwiki-api/matchers.rb', line 182
def weeks
@multiplier = 604800
self
end
|