class Eventifier::NotificationSubscriber
Attributes
klass[R]
method_name[R]
options[R]
Public Class Methods
new(klass, method_name, options)
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 6 def initialize(klass, method_name, options) @klass, @method_name, @options = klass, method_name, options end
subscribe_to_method(klass, method_name, options)
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 2 def self.subscribe_to_method(klass, method_name, options) new(klass, method_name, options).subscribe_to_method end
Public Instance Methods
subscribe_to_method()
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 10 def subscribe_to_method return if notifications.notifier.listening?(name) notifications.subscribe(name) do |*args| Eventifier::NotificationTranslator.new(prefix, options, *args).translate end end
Private Instance Methods
name()
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 22 def name "#{prefix}.notification.eventifier" end
notifications()
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 26 def notifications ActiveSupport::Notifications end
prefix()
click to toggle source
# File lib/eventifier/notifier/notification_subscriber.rb, line 30 def prefix "#{method_name}.#{klass.name.tableize}" end