Sha256: cfd31ac034a67ab3e01479cda627f9821724695e5f771ab8dd4c1ddb1a69107e

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

module PubsubNotifier
  module Client
    class Base
      def self.configure
        yield config
      end

      def self.config
        @_config ||= self::Config.new
      end

      def initialize(options = {})
      end

      def notify_success(message)
        raise NotImplementedError, "#{self.class}##{__method__} is not implemented"
      end

      def notify_failure(message)
        raise NotImplementedError, "#{self.class}##{__method__} is not implemented"
      end

      private

        def logger
          PubsubNotifier.config.logger
        end

        def config
          self.class.config
        end
    end

    class LoggerClient < Base
      def notify_success(message)
        logger.debug { "[#{self.class}##{__method__}] #{message}" }
      end

      def notify_failure(message)
        logger.debug { "[#{self.class}##{__method__}] #{message}" }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pubsub_notifier-0.1.2 lib/pubsub_notifier/client.rb
pubsub_notifier-0.1.1 lib/pubsub_notifier/client.rb