Class: ScraperWiki::API::Matchers::LastRunMatcher
Instance Method Summary
collapse
#does_not_match?, #initialize
Instance Method Details
#days ⇒ Object
Also known as:
day
187
188
189
190
|
# File 'lib/scraperwiki-api/matchers.rb', line 187
def days
@multiplier = 86400
self
end
|
#failure_message ⇒ Object
222
223
224
|
# File 'lib/scraperwiki-api/matchers.rb', line 222
def failure_message
"expected #{@actual['short_name']} to have run within #{span} seconds"
end
|
#hours ⇒ Object
Also known as:
hour
193
194
195
196
|
# File 'lib/scraperwiki-api/matchers.rb', line 193
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.
213
214
215
216
|
# File 'lib/scraperwiki-api/matchers.rb', line 213
def matches?(actual)
super
Time.now - Time.parse("#{@actual['last_run']}+01") < span
end
|
#minutes ⇒ Object
Also known as:
minute
199
200
201
202
|
# File 'lib/scraperwiki-api/matchers.rb', line 199
def minutes
@multiplier = 60
self
end
|
#months ⇒ Object
Also known as:
month
175
176
177
178
|
# File 'lib/scraperwiki-api/matchers.rb', line 175
def months
@multiplier = 2592000 self
end
|
#negative_failure_message ⇒ Object
226
227
228
|
# File 'lib/scraperwiki-api/matchers.rb', line 226
def negative_failure_message
"expected #{@actual['short_name']} to not have run within #{span} seconds"
end
|
#seconds ⇒ Object
Also known as:
second
205
206
207
208
|
# File 'lib/scraperwiki-api/matchers.rb', line 205
def seconds
@multiplier = 3600
self
end
|
#span ⇒ Object
218
219
220
|
# File 'lib/scraperwiki-api/matchers.rb', line 218
def span
@expected * (@multiplier || 1)
end
|
#weeks ⇒ Object
Also known as:
week
181
182
183
184
|
# File 'lib/scraperwiki-api/matchers.rb', line 181
def weeks
@multiplier = 604800
self
end
|