delayed_job_recurring 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fff505d7e12a6ba0aad2e7f8dd6ead4986a30980
4
- data.tar.gz: 12910c837cc398f16dae86c1acaa8387a8b36e18
2
+ SHA256:
3
+ metadata.gz: 87b52e2ea46027c5744c95fa27a1638975c7c15d3b0a1b5c1a1cdc26de139f2b
4
+ data.tar.gz: ef7cdcf38a80e0c6a696ef107af987baa7f4af7404a90dfce19b7c8b68704c83
5
5
  SHA512:
6
- metadata.gz: bde7769c64e1e7202481cb79f455a652ddf6ad952fc0fe59167e39c070f67ebf7748f487fb124874312ede5ea2125dac6bee441b5a0a8a05eb3af26344701675
7
- data.tar.gz: 2d7759c1d9860038b5a3ea7dbd53702ab44ad7243b0c9537f30cdfc2f32ad8e362c5f55da777a93aca4fad8dec98a0fdb3a596bb55d4872df285e962d7d79722
6
+ metadata.gz: 34922e47edf492128866c745520da14c23c8ac59e22bff14ccfdbb4d43376dac8406174fedca97e9006ee3a3f49d36ba1db5deb1e47d21286d37822dcdc57ebd
7
+ data.tar.gz: '091153def899859de2afca9aa956a5678f94657ff85cfa917dff368abc71067c6857957de3382e66dd246b93efbb4456dfe53d15a498d6163b429262762d33a6'
data/README.md CHANGED
@@ -39,7 +39,7 @@ The best practice is to add your `MyTask.schedule!` lines to a rake file, e.g.
39
39
  ```ruby
40
40
  # lib/tasks/recurring_jobs.rake
41
41
 
42
- namespace :recurring
42
+ namespace :recurring do
43
43
  task init: :environment do
44
44
  MyTask.schedule!
45
45
  MyOtherTask.schedule!
@@ -74,7 +74,7 @@ MyTask.schedule(run_at: '12:00')
74
74
  ### Running at multiples times each day
75
75
 
76
76
  ```ruby
77
- MyTask.schedule(run_every: 1.day, run_at: ['11:00', '6:00pm']
77
+ MyTask.schedule(run_every: 1.day, run_at: ['11:00', '6:00pm'])
78
78
  ```
79
79
 
80
80
  ### Running on specific days of the week
@@ -85,7 +85,7 @@ MyTask.schedule(run_every: 1.week, run_at: ['sunday 8:00am', 'wednesday 8:00am']
85
85
 
86
86
  ### Scheduling multiple jobs of same class
87
87
 
88
- By default, before scheduling a new job, the old jobs scheduled with the same class will be unscheduled.
88
+ By default, before scheduling a new job, the old jobs scheduled with the same class will be unscheduled.
89
89
 
90
90
  To schedule multiple jobs with same class, pass an unique matching param `job_matching_param` and value for that matching param in each job as below:
91
91
 
@@ -168,8 +168,9 @@ module Delayed
168
168
  if options[:job_matching_param].present?
169
169
  matching_key = options[:job_matching_param]
170
170
  matching_value = options[matching_key]
171
+ matching_yaml = yaml_quote(matching_value)
171
172
  query[0] = "#{query[0]} AND handler LIKE ?"
172
- query << "%#{matching_key}: #{matching_value}%"
173
+ query << "%#{matching_key}: #{matching_yaml}%"
173
174
  end
174
175
 
175
176
  ::Delayed::Job.where(query)
@@ -204,6 +205,14 @@ module Delayed
204
205
  end
205
206
  end
206
207
 
208
+ private
209
+ def yaml_quote(value)
210
+ # In order to ensure matching indentation, place the element inside a
211
+ # two-level hash (the first level mimicking 'schedule_options', the second
212
+ # for #{job_matching_param}), and strip out the leading "---\n:a:\n :a: "
213
+ # but keep the trailing newline.
214
+ ({a: {a: value}}).to_yaml[14..-1]
215
+ end
207
216
  end # ClassMethods
208
217
  end # RecurringJob
209
218
  end # Delayed
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_recurring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Novak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -166,9 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.6.8
169
+ rubygems_version: 2.7.6
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Recurring jobs for delayed_job
173
173
  test_files: []
174
- has_rdoc: