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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7857214fa6a81b4daa79df4247b40d7a807c50963a30c03b728452aa4c7a98ee
4
- data.tar.gz: e5bb7f26fc03c44b71f130e14cba3d3b92e66f11c217cd48464967ee8e88f985
3
+ metadata.gz: 367ce1b20a44bfc15ebf8aeaa0328ef90ad0673edd076e977d0e647a3a1b13b7
4
+ data.tar.gz: 437627e876b7e42243626bab168b9fd37d7da49c54309e2f8f9ef91dfb5e541b
5
5
  SHA512:
6
- metadata.gz: ce49d5a79dd42876bc83f5783e6b253a98edb1a21a6ddbe141bc3165aeff9efcd774bdfac6bf243643477b7401f547971f2eb9deb2c647ff162504ad62b5c0a7
7
- data.tar.gz: 32bcf1c228a088843d334296aea80025e5d6d3fb503d00773426a422701e64cf03357be08ded20f65b0cf763486bb0b7d9cbd779833611cc044b74c379ff28b2
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)
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "1.5.8"
2
+ VERSION = "1.5.9"
3
3
  end
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.8
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-03 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails