Sha256: 5353c355f954910ebe7a884c3507d65c865c07e42f641278e0273aab66dc00f3

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 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

1 entries across 1 versions & 1 rubygems

Version Path
pubsub_notifier-0.1.0 lib/pubsub_notifier/client.rb