Sha256: 53093b526d0d1b64b6738863e90bfca16d3e853130e27d08f84bfdf2122cc893

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

module Stenotype
  #
  # A namespace containing implementations of various adapters
  # for publishing events to various destinations.
  # e. g. (Google Cloud, Kafka, Stdout, other)
  #
  module Adapters
    #
    # An abstract base class for implementing adapters
    #
    # @abstract
    #
    class Base
      attr_reader :client

      #
      # @return {#publish} An adapter implementing method [#publish]
      #
      def initialize(client: nil)
        @client = client
      end

      #
      # This method is expected to be implemented by subclasses
      # @abstract
      # @raise [NotImplementedError] unless implemented in a subclass
      #
      def publish(_event_data, **_additional_arguments)
        raise NotImplementedError,
              "#{self.class.name} must implement method #publish"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stenotype-0.1.0 lib/stenotype/adapters/base.rb