Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions lib/mongoid/clients/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ def build_auto_encryption_options(opts, database)
version: VERSION
}.freeze

def driver_version
Mongo::VERSION.split('.')[0...2].map(&:to_i)
end

# Prepare options for Mongo::Client based on Mongoid client configuration.
#
# @param [ Hash ] opts Parameters from options section of Mongoid client configuration.
Expand All @@ -125,16 +121,14 @@ def options(opts)
options = opts.dup
options[:platform] = PLATFORM_DETAILS
options[:app_name] = Mongoid::Config.app_name if Mongoid::Config.app_name
if (driver_version <=> [ 2, 13 ]) >= 0
wrap_lib = if options[:wrapping_libraries]
[ MONGOID_WRAPPING_LIBRARY ] + options[:wrapping_libraries]
else
[ MONGOID_WRAPPING_LIBRARY ]
end.tap do |wrap|
wrap << { name: 'Rails', version: ::Rails.version } if defined?(::Rails) && ::Rails.respond_to?(:version)
end
options[:wrapping_libraries] = wrap_lib
wrap_lib = if options[:wrapping_libraries]
[ MONGOID_WRAPPING_LIBRARY ] + options[:wrapping_libraries]
else
[ MONGOID_WRAPPING_LIBRARY ]
end.tap do |wrap|
wrap << { name: 'Rails', version: ::Rails.version } if defined?(::Rails) && ::Rails.respond_to?(:version)
end
options[:wrapping_libraries] = wrap_lib
options.reject { |k, _v| k == :hosts }.to_hash.symbolize_keys!
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mongoid/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ def global_client
end
end

# Wraps configuration options that have been deprecated so that assigning
# them emits a deprecation warning. OPTIONS is intentionally empty when no
# options are currently deprecated; it is populated as options are retired,
# at which point this module rewrites their setters to warn.
module DeprecatedOptions
OPTIONS = %i[]

Expand Down
Loading