Sha256: 6c7d55010c353c6ea90e1539dc3782fd31919091e123a45cd5170d504a9bedca
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
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 # @example Defining a custom adapter # MyCustomAdapter < Stenotype::Adapters::Base # def publish(event_data, **additional_arguments) # client.publish(event_data, **additional_arguments) # end # # def client # @client ||= SomeCustomClient.new(some_credential) # end # end # 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_attrs) raise NotImplementedError, "#{self.class.name} must implement method #publish" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stenotype-0.1.4 | lib/stenotype/adapters/base.rb |
stenotype-0.1.2 | lib/stenotype/adapters/base.rb |