noticed 1.5.8 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/lib/noticed/base.rb +3 -0
- data/lib/noticed/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367ce1b20a44bfc15ebf8aeaa0328ef90ad0673edd076e977d0e647a3a1b13b7
|
4
|
+
data.tar.gz: 437627e876b7e42243626bab168b9fd37d7da49c54309e2f8f9ef91dfb5e541b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5991aa837054391b01f5614617db15951279d4015c96eab52194ad7a0ab05cf3d586353cb5968bb04584246b23682c75365858464062c852b70f9553f0be8ad5
|
7
|
+
data.tar.gz: ff4adba6ae61a08bf8dab9a4b27899c3e5dd3dea8e1475fa7f1da589db85ce17b264d02ed523ea38d905bd53016f2e1d483cf4a7c18ea9461e1b12ef056868e6
|
data/README.md
CHANGED
@@ -106,9 +106,10 @@ end
|
|
106
106
|
|
107
107
|
**Shared Options**
|
108
108
|
|
109
|
-
* `if: :method_name` - Calls `method_name`and cancels delivery method if `false` is returned
|
110
|
-
* `unless: :method_name` - Calls `method_name`and cancels delivery method if `true` is returned
|
109
|
+
* `if: :method_name` - Calls `method_name` and cancels delivery method if `false` is returned
|
110
|
+
* `unless: :method_name` - Calls `method_name` and cancels delivery method if `true` is returned
|
111
111
|
* `delay: ActiveSupport::Duration` - Delays the delivery for the given duration of time
|
112
|
+
* `delay: :method_name` - Calls `method_name which should return an `ActiveSupport::Duration` and delays the delivery for the given duration of time
|
112
113
|
|
113
114
|
##### Helper Methods
|
114
115
|
|
@@ -198,11 +199,11 @@ A common use case is to trigger a notification when a record is created. For exa
|
|
198
199
|
```ruby
|
199
200
|
class Message < ApplicationRecord
|
200
201
|
belongs_to :recipient, class_name: "User"
|
201
|
-
|
202
|
+
|
202
203
|
after_create_commit :notify_recipient
|
203
|
-
|
204
|
+
|
204
205
|
private
|
205
|
-
|
206
|
+
|
206
207
|
def notify_recipient
|
207
208
|
NewMessageNotification.with(message: self).deliver_later(recipient)
|
208
209
|
end
|
data/lib/noticed/base.rb
CHANGED
@@ -112,6 +112,9 @@ module Noticed
|
|
112
112
|
|
113
113
|
# Always perfrom later if a delay is present
|
114
114
|
if (delay = delivery_method.dig(:options, :delay))
|
115
|
+
# Dynamic delays with metho calls or
|
116
|
+
delay = send(delay) if delay.is_a? Symbol
|
117
|
+
|
115
118
|
method.set(wait: delay, queue: queue).perform_later(args)
|
116
119
|
elsif enqueue
|
117
120
|
method.set(queue: queue).perform_later(args)
|
data/lib/noticed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|