Sha256: 88d44862ec098a44062cbb3336f748522f3c4632e0f3e40ec43dbda0c34130c9
Contents?: true
Size: 607 Bytes
Versions: 16
Compression:
Stored size: 607 Bytes
Contents
module NotificationHelpers def with_subscription_to(matcher, notification_callable) subscription = ActiveSupport::Notifications.subscribe(matcher, notification_callable) yield ensure ActiveSupport::Notifications.unsubscribe(subscription) end def listeners_for(event_name) ActiveSupport::Notifications.notifier.listeners_for(event_name) end def subscribers_for(event_name) listeners_for(event_name).map{ |listener| listener.instance_variable_get('@delegate') } end def subscriber_classes_for(event_name) subscribers_for(event_name).map(&:class) end end
Version data entries
16 entries across 16 versions & 1 rubygems