lib/basquiat/interfaces/base.rb in basquiat-1.3.0.pre.1 vs lib/basquiat/interfaces/base.rb in basquiat-1.3.0
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require 'set'
module Basquiat
# Base module used to extend the classes so that they will be able to use the event infrastructure
module Base
@@ -9,10 +10,14 @@
end
def descendants
@descendants ||= []
end
+
+ def reconfigure_children
+ descendants.each(&:reload_adapter_from_configuration)
+ end
end
def reload_adapter_from_configuration
@adapter = Kernel.const_get Basquiat.configuration.default_adapter
adapter_options Basquiat.configuration.adapter_options
@@ -23,10 +28,11 @@
# @return [Basquiat::Adapter] the adapter instance for the current class
# @deprecated event_adapter is deprecated and will be removed eventually. Please use {#adapter}.
def adapter=(adapter_klass)
@adapter = adapter_klass.new
end
- alias_method :event_adapter=, :adapter=
+
+ alias event_adapter= adapter=
def adapter
@adapter ||= Kernel.const_get(Basquiat.configuration.default_adapter).new
end