Sha256: 896b0d941bf85fe96fff03f65971c6e4ce21e4057a1775b00240bd06279b7ddf
Contents?: true
Size: 941 Bytes
Versions: 14
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Spree module Event module Adapters module ActiveSupportNotifications extend self def fire(event_name, opts) ActiveSupport::Notifications.instrument event_name, opts do yield opts if block_given? end end def subscribe(event_name) ActiveSupport::Notifications.subscribe event_name do |*args| event = ActiveSupport::Notifications::Event.new(*args) yield event end end def unsubscribe(subscriber_or_name) ActiveSupport::Notifications.unsubscribe(subscriber_or_name) end def listeners_for(names) names.each_with_object({}) do |name, memo| listeners = ActiveSupport::Notifications.notifier.listeners_for(name) memo[name] = listeners if listeners.present? end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems