active_job-performs 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/active_job/performs/version.rb +1 -1
- data/lib/active_job/performs.rb +14 -2
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98388c4ee6fae085e8fca9635ac1e02781c612b5481c89f12f83e0b73884a834
|
|
4
|
+
data.tar.gz: 646fc3cf2ec5b002168d817eee80ab911e635595a6c5b702784bb7685075353f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec5540e89046e0e76114467ed9f0890e2133d9c6877cbb6522cd202f931ddc71a79a13fddc5a70faa22a33ec7e8a77170cbd767a8c9a0ab1355358d59fd7ea85
|
|
7
|
+
data.tar.gz: 5bd6b34a001a436c1e795e86c819a48e56ee0b8eab2c962b59c8d16bd8e0924b4b9d709c3543a9c2047970600a7c74a60a8cc7c480da2672d8d60453e3f6feaf
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -308,6 +308,8 @@ class Post < ActiveRecord::Base
|
|
|
308
308
|
|
|
309
309
|
# Additionally, a block can be passed to have access to the `post`:
|
|
310
310
|
performs :social_media_boost, wait: -> post { post.social_media_boost_grace_period }
|
|
311
|
+
performs :social_media_boost, wait: :social_media_boost_grace_period # The symbol version also supports calling private methods
|
|
312
|
+
def social_media_boost_grace_period = 5.minutes
|
|
311
313
|
end
|
|
312
314
|
```
|
|
313
315
|
|
data/lib/active_job/performs.rb
CHANGED
|
@@ -8,11 +8,11 @@ module ActiveJob::Performs
|
|
|
8
8
|
attr_reader :wait, :wait_until
|
|
9
9
|
|
|
10
10
|
def wait=(value)
|
|
11
|
-
@wait = value
|
|
11
|
+
@wait = normalize_wait(value)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def wait_until=(value)
|
|
15
|
-
@wait_until = value
|
|
15
|
+
@wait_until = normalize_wait(value)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def scoped_by_wait(record)
|
|
@@ -22,6 +22,18 @@ module ActiveJob::Performs
|
|
|
22
22
|
self
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
def normalize_wait(value)
|
|
28
|
+
case value
|
|
29
|
+
when Symbol
|
|
30
|
+
proc { _1.send value }
|
|
31
|
+
when Proc
|
|
32
|
+
value.arity.zero? ? proc { value.call } : value
|
|
33
|
+
else
|
|
34
|
+
proc { value }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
25
37
|
end
|
|
26
38
|
|
|
27
39
|
def performs(method = nil, **configs, &block)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_job-performs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kasper Timm Hansen
|
|
@@ -29,6 +29,7 @@ executables: []
|
|
|
29
29
|
extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
|
31
31
|
files:
|
|
32
|
+
- ".ruby-version"
|
|
32
33
|
- CHANGELOG.md
|
|
33
34
|
- Gemfile
|
|
34
35
|
- Gemfile.lock
|