25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/jmongo/mongo/connection.rb', line 25
def _from_uri uri, opts={}
optarr = []
unless uri =~ URI_RE
raise MongoArgumentError, "MongoDB URI incorrect"
end
pieces = uri.split("//")
= pieces.last.count('/') == 0 ? "/" : ""
opts.each do|k,v|
if OPTS_KEYS.include?(k.to_s) && !v.nil?
(optarr << "#{k}=#{v}")
end
end
unless optarr.empty?
uri << "#{}?" << optarr.join("&")
end
opts[:new_from_uri] = Java::ComMongodb::MongoURI.new(uri)
new("",0,opts)
end
|