job_boss 0.7.10 → 0.7.11
Sign up to get free protection for your applications and to get access to all the features.
- data/job_boss.gemspec +1 -1
- data/lib/job_boss/job.rb +14 -9
- metadata +3 -3
data/job_boss.gemspec
CHANGED
data/lib/job_boss/job.rb
CHANGED
@@ -199,8 +199,7 @@ module JobBoss
|
|
199
199
|
# Returns a hash where the keys are the job method arguments and the values are the
|
200
200
|
# results of the job processing
|
201
201
|
def result_hash(jobs = nil)
|
202
|
-
jobs
|
203
|
-
jobs = self.scoped if jobs.nil?
|
202
|
+
get_jobs(jobs)
|
204
203
|
|
205
204
|
# the #result method automatically reloads the result here if needed but this will
|
206
205
|
# do it in one SQL call
|
@@ -213,17 +212,23 @@ module JobBoss
|
|
213
212
|
end
|
214
213
|
|
215
214
|
def cancelled?(jobs = nil)
|
216
|
-
|
217
|
-
count = Job.where('id in (?)', jobs).where('cancelled_at IS NULL').count
|
215
|
+
get_jobs(jobs)
|
218
216
|
|
219
|
-
|
220
|
-
|
217
|
+
count = self.where('cancelled_at IS NULL').count
|
218
|
+
|
219
|
+
!(count > 0)
|
221
220
|
end
|
222
221
|
|
223
222
|
def cancel(jobs = nil)
|
224
|
-
|
225
|
-
|
226
|
-
|
223
|
+
get_jobs(jobs)
|
224
|
+
|
225
|
+
self.all.each(&:cancel)
|
226
|
+
end
|
227
|
+
|
228
|
+
def get_jobs(jobs)
|
229
|
+
jobs = [jobs] if jobs.is_a?(Job)
|
230
|
+
jobs = self.scoped if jobs.nil?
|
231
|
+
jobs
|
227
232
|
end
|
228
233
|
|
229
234
|
# Given a time object
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_boss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 11
|
10
|
+
version: 0.7.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Underwood
|