Class: Eventifier::NotificationTranslator
- Inherits:
-
Object
- Object
- Eventifier::NotificationTranslator
- Defined in:
- lib/eventifier/notification_translator.rb
Instance Method Summary collapse
-
#initialize(prefix, options, *args) ⇒ NotificationTranslator
constructor
A new instance of NotificationTranslator.
- #translate ⇒ Object
Constructor Details
#initialize(prefix, options, *args) ⇒ NotificationTranslator
Returns a new instance of NotificationTranslator.
2 3 4 5 |
# File 'lib/eventifier/notification_translator.rb', line 2 def initialize(prefix, , *args) @prefix, @options = prefix, @event = ActiveSupport::Notifications::Event.new(*args).payload[:event] end |
Instance Method Details
#translate ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/eventifier/notification_translator.rb', line 7 def translate return if skip? users_and_relations do |user, relations| next if user == event.user && ![:notify_self] next if skip?(user) Eventifier::Notification.create event: event, user: user, relations: relations Eventifier::Delivery.deliver_for user if [:email] == :immediate end end |