def instantiate_adapter(config)
adapter = (config[:adapter] || "ldap")
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)
logger.warning do
_(":ldap_scope connection option is deprecated. Use :scope instead.")
end
config[:scope] ||= config.delete(:ldap_scope)
end
config = remove_connection_related_configuration(config)
Adapter::Base.send(adapter_method, config)
end