job_boss 0.7.10 → 0.7.11

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.
Files changed (3) hide show
  1. data/job_boss.gemspec +1 -1
  2. data/lib/job_boss/job.rb +14 -9
  3. metadata +3 -3
data/job_boss.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "job_boss"
7
- s.version = '0.7.10'
7
+ s.version = '0.7.11'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Brian Underwood"]
10
10
  s.email = ["ml+job_boss@semi-sentient.com"]
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 = [jobs] if jobs.is_a?(Job)
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
- if jobs
217
- count = Job.where('id in (?)', jobs).where('cancelled_at IS NULL').count
215
+ get_jobs(jobs)
218
216
 
219
- !(count > 0)
220
- end
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
- if jobs
225
- jobs.each(&:cancel)
226
- end
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 10
10
- version: 0.7.10
9
+ - 11
10
+ version: 0.7.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Underwood