Sha256: 0c16ff22182fb1d02a97cd7f885947abe4071a5057a99677bc2df289d1c66404

Contents?: true

Size: 908 Bytes

Versions: 23

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

require 'active_support/notifications'

require 'singleton'

module Praxis
  module Notifications
    include Praxis::PluginConcern

    class Plugin < Praxis::Plugin
      include Singleton

      def config_key
        :notifications # 'praxis.notifications'
      end
    end

    def self.publish(name, *args)
      ActiveSupport::Notifications.publish(name, *args)
    end

    def self.instrument(name, payload = {}, &block)
      ActiveSupport::Notifications.instrument(name, **payload, &block)
    end

    def self.subscribe(*args, &block)
      ActiveSupport::Notifications.subscribe(*args, &block)
    end

    def self.subscribed(callback, *args, &block)
      ActiveSupport::Notifications.subscribed(callback, *args, &block)
    end

    def self.unsubscribe(subscriber_or_name)
      ActiveSupport::Notifications.unsubscribe(subscriber_or_name)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
praxis-2.0.pre.21 lib/praxis/notifications.rb
praxis-2.0.pre.20 lib/praxis/notifications.rb
praxis-2.0.pre.19 lib/praxis/notifications.rb