lib/basquiat/adapters/base_adapter.rb in basquiat-1.1.1 vs lib/basquiat/adapters/base_adapter.rb in basquiat-1.2.0

- old
+ new

@@ -1,17 +1,34 @@ +require 'delegate' +require 'basquiat/adapters/base_message' + module Basquiat module Adapters # Base implementation for an adapter - module Base + class Base using Basquiat::HashRefinements + class << self + def strategies + @strategies ||= {} + end + + def register_strategy(config_name, klass) + strategies.merge!(config_name.to_sym => klass) + end + end + def initialize @options = base_options @procs = {} @retries = 0 end + def strategies + self.class.strategies + end + # Used to set the options for the adapter. It is merged in # to the default_options hash. # @param [Hash] opts an adapter dependant hash of options def adapter_options(opts) @options.deep_merge(opts) @@ -25,30 +42,23 @@ def default_options {} end - def update_config - end - def publish + fail Basquiat::Errors::SubclassResponsibility end def subscribe_to + fail Basquiat::Errors::SubclassResponsibility end def disconnect + fail Basquiat::Errors::SubclassResponsibility end - def disconnected? - end - private attr_reader :procs, :options - - def logger - Basquiat.configuration.logger - end end end end