class Dallal::Events::EventSubscriber

Attributes

payload[R]

Public Class Methods

new(payload) click to toggle source
# File lib/dallal/events/event_subscriber.rb, line 11
def initialize(payload)
  @payload = payload
end

Public Instance Methods

execute() click to toggle source
# File lib/dallal/events/event_subscriber.rb, line 15
def execute
  if should_create_notifications?
    DallalJob.perform_later payload[:class], payload[:id], payload[:event].to_s
  end
end

Private Instance Methods

should_create_notifications?() click to toggle source

TODO This silently ignores creating a notification add a warning here or raise exception if not applicable

# File lib/dallal/events/event_subscriber.rb, line 26
def should_create_notifications?
  # Are notifications enabled? && is class in Notifiables?
  Dallal.configuration.enabled? && Observer::NOTIFIABLES.include?(payload[:class])
end