6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/scruber/mongo/factory.rb', line 6
def create_client(client_name=:default)
raise Scruber::ArgumentError.new("Not configured") unless Scruber::Mongo.configuration.configured?(client_name)
configuration = Scruber::Mongo.configuration.clients[client_name]
if configuration[:uri]
::Mongo::Client.new(configuration[:uri], options(configuration))
else
::Mongo::Client.new(
configuration[:hosts],
options(configuration).merge(database: configuration[:database])
)
end
end
|