def instantiate_adapter(config)
adapter = (config[:adapter] || default_adapter)
normalized_adapter = adapter.downcase.gsub(/-/, "_")
adapter_method = "#{normalized_adapter}_connection"
unless Adapter::Base.respond_to?(adapter_method)
raise AdapterNotFound.new(adapter)
end
if config.has_key?(:ldap_scope)
message = _(":ldap_scope connection option is deprecated. " \
"Use :scope instead.")
ActiveSupport::Deprecation.warn(message)
config[:scope] ||= config.delete(:ldap_scope)
end
config = remove_connection_related_configuration(config)
Adapter::Base.send(adapter_method, config)
end