Module: ActiveRecordConnectionTz::Adapters::Shared
- Defined in:
- lib/active_record_connection_tz/adapters/shared.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.install!(adapter_module:, hook_name:) ⇒ Object
: (adapter_module: Module, hook_name: Symbol) -> void.
Class Method Details
.install!(adapter_module:, hook_name:) ⇒ Object
: (adapter_module: Module, hook_name: Symbol) -> void
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/active_record_connection_tz/adapters/shared.rb', line 10 def install!(adapter_module:, hook_name:) return if adapter_module.instance_variable_get(:@installed) instance_methods = adapter_module.const_get(:InstanceMethods, false) ActiveSupport.on_load(hook_name) do singleton_class.prepend(Shared::ClassMethods) unless singleton_class < Shared::ClassMethods prepend(Shared::InstanceMethods) unless self < Shared::InstanceMethods prepend(instance_methods) unless self < instance_methods end adapter_module.instance_variable_set(:@installed, true) end |