# File lib/mongo/cluster/topology.rb, line 69 def initial(cluster, monitoring, options) cls = if options.key?(:connect) OPTIONS.fetch(options[:connect].to_sym) elsif options.key?(:replica_set) || options.key?(:replica_set_name) ReplicaSetNoPrimary else Unknown end # Options here are client/cluster/server options. # In particular the replica set name key is different for # topology. # If replica_set_name is given (as might be internally by driver), # use that key. # Otherwise (e.g. options passed down from client), # move replica_set to replica_set_name. if (cls <= ReplicaSetNoPrimary || cls == Single) && !options[:replica_set_name] options = options.dup options[:replica_set_name] = options.delete(:replica_set) end cls.new(options, monitoring, cluster) end