Class: AbstractNotifier::Notification
- Inherits:
-
Object
- Object
- AbstractNotifier::Notification
- Includes:
- Testing::Notification
- Defined in:
- lib/abstract_notifier/base.rb
Overview
Notificaiton payload wrapper which contains information about the current notifier class and knows how to trigger the delivery
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(owner, payload) ⇒ Notification
constructor
A new instance of Notification.
- #notify_later ⇒ Object
- #notify_now ⇒ Object
Constructor Details
#initialize(owner, payload) ⇒ Notification
Returns a new instance of Notification.
10 11 12 13 |
# File 'lib/abstract_notifier/base.rb', line 10 def initialize(owner, payload) @owner = owner @payload = payload end |
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
8 9 10 |
# File 'lib/abstract_notifier/base.rb', line 8 def owner @owner end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
8 9 10 |
# File 'lib/abstract_notifier/base.rb', line 8 def payload @payload end |
Instance Method Details
#notify_later ⇒ Object
15 16 17 18 |
# File 'lib/abstract_notifier/base.rb', line 15 def notify_later return if AbstractNotifier.noop? owner.async_adapter.enqueue owner, payload end |
#notify_now ⇒ Object
20 21 22 23 |
# File 'lib/abstract_notifier/base.rb', line 20 def notify_now return if AbstractNotifier.noop? owner.driver.call(payload) end |