lib/mongoid/clients/options.rb in mongoid-5.2.1 vs lib/mongoid/clients/options.rb in mongoid-5.4.0
- old
+ new
@@ -133,11 +133,11 @@
#
# @example Set the persistence options and client with those options on the current thread.
# Threaded.set_options(Band, { write: { w: 3 }})
#
# @param [ Class ] klass The model class.
- # @param [ Mongo::Client ] client The client with options.
+ # @param [ Mongo::Client ] options The options.
#
# @return [ Mongo::Client, nil ] The client or nil if the cluster does not change.
#
# @since 5.1.0
def set_options(klass, options)
@@ -250,11 +250,12 @@
#
# @since 3.0.0
def with(options)
if block_given?
set_options(self, options)
- yield self
+ result = yield self
unset_options(self)
+ result
else
Proxy.new(self, (persistence_options || {}).merge(options))
end
end
end