Sha256: d1b2100bc54e7fb2f43a0eed7bf186d0d1616a165c6eff33d11f9834d19affa7

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

module PubsubNotifier
  module Broadcasters
    class Base
      attr_accessor :options

      def initialize
        @options = {}
      end

      def configure(opts = {})
        self.options = default_options.merge(opts).reject { |_, v| v.nil? }.each_with_object({}) do |(key, proc_or_value), result|
          result[key] = proc_or_value.is_a?(Proc) ? proc_or_value.call : proc_or_value
        end
      end

      def broadcast(subscriber, publisher, event, *args)
        raise NotImplementedError
      end

      private

        def logger
          PubsubNotifier.config.logger
        end

        def default_options
          {}
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pubsub_notifier-0.1.2 lib/pubsub_notifier/broadcasters.rb
pubsub_notifier-0.1.1 lib/pubsub_notifier/broadcasters.rb
pubsub_notifier-0.1.0 lib/pubsub_notifier/broadcasters.rb