Class: Mongo::URI::OptionsMapper Private
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
::Mongo::Loggable
|
|
| Inherits: | Object |
| Defined in: | lib/mongo/uri/options_mapper.rb |
Overview
Performs mapping between ::Mongo::URI options and Ruby options.
This class contains:
-
The mapping defining how
::Mongo::URIoptions are converted to Ruby options. -
The mapping from downcased
::Mongo::URIoption names to canonical-cased::Mongo::URIoption names. -
Methods to perform conversion of
::Mongo::URIoption values to Ruby option values (the convert_* methods). These generally warn and return nil when input given is invalid. -
Methods to perform conversion of Ruby option values to standardized MongoClient options (revert_* methods). These assume the input is valid and generally do not perform validation.
::Mongo::URI option names are case insensitive. Ruby options are specified as symbols (though in ::Mongo::Client options use indifferent access).
Constant Summary
-
URI_OPTION_CANONICAL_NAMES =
# File 'lib/mongo/uri/options_mapper.rb', line 195
{} -
URI_OPTION_MAP =
# File 'lib/mongo/uri/options_mapper.rb', line 190
Hash for storing map of
::Mongo::URIoption parameters to conversion strategies{}
::Mongo::Loggable - Included
Class Method Summary
-
.new(**opts) ⇒ OptionsMapper
constructor
Internal use only
Instantates the options mapper.
-
.uri_option(uri_key, name, **extra)
Internal use only
Simple internal dsl to register a MongoDB URI option in the URI_OPTION_MAP.
Instance Attribute Summary
- #options ⇒ Hash readonly Internal use only
Instance Method Summary
-
#add_uri_option(key, value, uri_options)
Internal use only
Adds an option to the uri options hash.
-
#ruby_to_smc(opts) ⇒ Hash
Internal use only
Converts Ruby options provided to “standardized MongoClient options”.
-
#ruby_to_string(opts) ⇒ Hash
Internal use only
Converts Ruby options provided to their representation in a
::Mongo::URIstring. - #smc_to_ruby(opts) Internal use only
-
#apply_transform(key, value, type)
private
Internal use only
Applies URI value transformation by either using the default cast or a transformation appropriate for the given type.
-
#convert_array(_name, value) ⇒ Array<String>
private
Internal use only
Extract values from the string and put them into an array.
-
#convert_auth_mech(_name, value) ⇒ Symbol
private
Internal use only
Authentication mechanism transformation.
-
#convert_auth_mech_props(_name, value) ⇒ Hash | nil
private
Internal use only
::Mongo::Authmechanism properties extractor. -
#convert_bool(name, value) ⇒ true | false | nil
private
Internal use only
Converts
valueto a boolean. -
#convert_integer(name, value) ⇒ nil | Integer
private
Internal use only
Converts
valueinto an integer. -
#convert_inverse_bool(name, value) ⇒ true | false | nil
private
Internal use only
Parses a boolean value and returns its inverse.
-
#convert_max_staleness(_name, value) ⇒ Integer | nil
private
Internal use only
Parses the max staleness value, which must be either “0” or an integer greater or equal to 90.
-
#convert_ms(name, value) ⇒ Float
private
Internal use only
Ruby’s convention is to provide timeouts in seconds, not milliseconds and to use fractions where more precision is necessary.
-
#convert_read_mode(_name, value) ⇒ Symbol | String
private
Internal use only
Read preference mode transformation.
-
#convert_read_set(_name, value) ⇒ Hash
private
Internal use only
Read preference tag set extractor.
-
#convert_read_tags(name, value) ⇒ Array<Hash> | nil
private
Internal use only
Read preference tags transformation.
-
#convert_repeated_bool(name, value) ⇒ Array<true | false> | nil
private
Internal use only
Converts the value into a boolean and returns it wrapped in an array.
-
#convert_server_monitoring_mode(_name, value) ⇒ Symbol | nil
private
Internal use only
::Mongo::Servermonitoring mode transformation. -
#convert_symbol(_name, value) ⇒ Symbol
private
Internal use only
Converts
valueinto a symbol. -
#convert_w(_name, value) ⇒ Integer | Symbol | String
private
Internal use only
Converts
valueas a write concern. -
#convert_zlib_compression_level(_name, value) ⇒ Integer | nil
private
Internal use only
Parses the zlib compression level.
-
#hash_extractor(name, value) ⇒ Hash
private
Internal use only
Extract values from the string and put them into a nested hash.
-
#merge_uri_option(target, value, name)
private
Internal use only
Merges a new option into the target.
-
#revert_array(value) ⇒ Array<String>
private
Internal use only
Reverts an array.
-
#revert_auth_mech(value) ⇒ String
private
Internal use only
Reverts auth mechanism.
-
#revert_auth_mech_props(value) ⇒ Hash | nil
private
Internal use only
Reverts auth mechanism properties.
-
#revert_bool(value) ⇒ true | false | nil
private
Internal use only
Reverts a boolean type.
-
#revert_integer(value) ⇒ Integer | nil
private
Internal use only
Reverts an integer.
-
#revert_inverse_bool(value) ⇒ true | false | nil
private
Internal use only
Reverts and inverts a boolean type.
-
#revert_max_staleness(value) ⇒ Integer | nil
private
Internal use only
Reverts max staleness.
-
#revert_ms(value) ⇒ Integer
private
Internal use only
Reverts an ms.
-
#revert_read_mode(value) ⇒ String
(also: #stringify_read_mode)
private
Internal use only
Reverts read mode.
-
#revert_read_tags(value) ⇒ Array<Hash> | nil
private
Internal use only
Reverts read tags.
-
#revert_repeated_bool(value) ⇒ Array<true | false> | true | false | nil
private
Internal use only
Reverts a repeated boolean type.
-
#revert_symbol(value) ⇒ String
(also: #stringify_symbol)
private
Internal use only
Reverts a symbol.
-
#revert_w(value) ⇒ Integer | String
private
Internal use only
Reverts write concern.
-
#revert_zlib_compression_level(value) ⇒ Integer | nil
private
Internal use only
Reverts zlib compression level.
-
#stringify_array(value) ⇒ String
private
Internal use only
Stringifies an array.
-
#stringify_auth_mech(value) ⇒ String | nil
private
Internal use only
Stringifies auth mechanism.
-
#stringify_auth_mech_props(value) ⇒ String | nil
private
Internal use only
Stringifies auth mechanism properties.
-
#stringify_bool(value) ⇒ String | nil
private
Internal use only
Stringifies a boolean type.
-
#stringify_integer(value) ⇒ String | nil
private
Internal use only
Stringifies an integer.
-
#stringify_inverse_bool(value) ⇒ String | nil
private
Internal use only
Inverts and stringifies a boolean.
-
#stringify_max_staleness(value) ⇒ String | nil
private
Internal use only
Stringifies max staleness.
-
#stringify_ms(value) ⇒ String
private
Internal use only
Stringifies an ms.
-
#stringify_read_mode(value)
private
Alias for #revert_read_mode.
-
#stringify_read_tags(value) ⇒ String | nil
private
Internal use only
Stringifies read tags.
-
#stringify_repeated_bool(value) ⇒ Array<true | false> | nil
private
Internal use only
Stringifies a repeated boolean type.
-
#stringify_server_monitoring_mode(value) ⇒ String
private
Internal use only
Stringifies server monitoring mode.
-
#stringify_symbol(value)
private
Alias for #revert_symbol.
-
#stringify_w(value) ⇒ String
private
Internal use only
Stringifies write concern.
-
#stringify_zlib_compression_level(value) ⇒ String | nil
private
Internal use only
Stringifies zlib compression level.
::Mongo::Loggable - Included
| #log_debug | Convenience method to log debug messages with the standard prefix. |
| #log_error | Convenience method to log error messages with the standard prefix. |
| #log_fatal | Convenience method to log fatal messages with the standard prefix. |
| #log_info | Convenience method to log info messages with the standard prefix. |
| #log_warn | Convenience method to log warn messages with the standard prefix. |
| #logger | Get the logger instance. |
| #_mongo_log_prefix, #format_message | |
Class Method Details
.uri_option(uri_key, name, **extra)
Simple internal dsl to register a MongoDB URI option in the URI_OPTION_MAP.
# File 'lib/mongo/uri/options_mapper.rb', line 205
def self.uri_option(uri_key, name, **extra) URI_OPTION_MAP[uri_key.downcase] = { name: name }.update(extra) URI_OPTION_CANONICAL_NAMES[uri_key.downcase] = uri_key end
Instance Attribute Details
#options ⇒ Hash (readonly)
# File 'lib/mongo/uri/options_mapper.rb', line 48
attr_reader :
Instance Method Details
#add_uri_option(key, value, uri_options)
Adds an option to the uri options hash.
Acquires a target for the option based on group.
Transforms the value.
Merges the option into the target.
# File 'lib/mongo/uri/options_mapper.rb', line 59
def add_uri_option(key, value, ) strategy = URI_OPTION_MAP[key.downcase] if strategy.nil? log_warn("Unsupported URI option '#{key}' on URI '#{@string}'. It will be ignored.") return end group = strategy[:group] target = if group [group] || {} else end value = apply_transform(key, value, strategy[:type]) # Sometimes the value here would be nil, for example if we are processing # read preference tags or auth mechanism properties and all of the # data within is invalid. Ignore such options. merge_uri_option(target, value, strategy[:name]) unless value.nil? return unless group && !target.empty? && !.key?(group) [group] = target end
#apply_transform(key, value, type) (private)
Applies URI value transformation by either using the default cast or a transformation appropriate for the given type.
# File 'lib/mongo/uri/options_mapper.rb', line 218
def apply_transform(key, value, type) if type send("convert_#{type}", key, value) else value end end
#convert_array(_name, value) ⇒ Array<String> (private)
Extract values from the string and put them into an array.
# File 'lib/mongo/uri/options_mapper.rb', line 536
def convert_array(_name, value) value.split(',') end
#convert_auth_mech(_name, value) ⇒ Symbol (private)
Authentication mechanism transformation.
# File 'lib/mongo/uri/options_mapper.rb', line 564
def convert_auth_mech(_name, value) auth_mech = AUTH_MECH_MAP[value.upcase] (auth_mech || value).tap do |_mech| log_warn("#{value} is not a valid auth mechanism") unless auth_mech end end
#convert_auth_mech_props(_name, value) ⇒ Hash | nil (private)
::Mongo::Auth mechanism properties extractor.
# File 'lib/mongo/uri/options_mapper.rb', line 604
def convert_auth_mech_props(_name, value) properties = hash_extractor('authMechanismProperties', value) if properties properties.each do |k, v| properties[k] = (v.downcase == 'true') if k.to_s.downcase == 'canonicalize_host_name' && v end end properties end
#convert_bool(name, value) ⇒ true | false | nil (private)
Converts value to a boolean.
Returns true for ‘true’, false for ‘false’, otherwise nil.
# File 'lib/mongo/uri/options_mapper.rb', line 325
def convert_bool(name, value) case value when true, 'true', 'TRUE' true when false, 'false', 'FALSE' false else log_warn("invalid boolean option for #{name}: #{value}") nil end end
#convert_integer(name, value) ⇒ nil | Integer (private)
Converts value into an integer. Only converts positive integers.
If the value is not a valid integer, warns and returns nil.
# File 'lib/mongo/uri/options_mapper.rb', line 432
def convert_integer(name, value) if value.is_a?(String) && /\A\d+\z/ !~ value log_warn("#{value} is not a valid integer for #{name}") return nil end value.to_i end
#convert_inverse_bool(name, value) ⇒ true | false | nil (private)
Parses a boolean value and returns its inverse.
# File 'lib/mongo/uri/options_mapper.rb', line 396
def convert_inverse_bool(name, value) b = convert_bool(name, value) if b.nil? nil else !b end end
#convert_max_staleness(_name, value) ⇒ Integer | nil (private)
Parses the max staleness value, which must be either “0” or an integer greater or equal to 90.
# File 'lib/mongo/uri/options_mapper.rb', line 642
def convert_max_staleness(_name, value) int = if value.is_a?(String) && /\A-?\d+\z/ =~ value value.to_i elsif value.is_a?(Integer) value end if int.nil? log_warn("Invalid max staleness value: #{value}") return nil end int = nil if int == -1 if int && ((int > 0 && int < 90) || int < 0) log_warn("max staleness should be either 0 or greater than 90: #{value}") int = nil end int end
#convert_ms(name, value) ⇒ Float (private)
Ruby’s convention is to provide timeouts in seconds, not milliseconds and to use fractions where more precision is necessary. The connection string options are always in MS so we provide an easy conversion type.
# File 'lib/mongo/uri/options_mapper.rb', line 469
def convert_ms(name, value) case value when String unless /\A-?\d+(\.\d+)?\z/.match?(value) log_warn("Invalid ms value for #{name}: #{value}") return nil end if value.to_s[0] == '-' log_warn("#{name} cannot be a negative number") return nil end when Integer, Float if value < 0 log_warn("#{name} cannot be a negative number") return nil end else raise ArgumentError, "Can only convert Strings, Integers, or Floats to ms. Given: #{value.class}" end value.to_f / 1000 end
#convert_read_mode(_name, value) ⇒ Symbol | String (private)
Read preference mode transformation.
# File 'lib/mongo/uri/options_mapper.rb', line 688
def convert_read_mode(_name, value) READ_MODE_MAP[value.downcase] || value end
#convert_read_set(_name, value) ⇒ Hash (private)
Read preference tag set extractor.
# File 'lib/mongo/uri/options_mapper.rb', line 764
def convert_read_set(_name, value) hash_extractor('readPreferenceTags', value) end
#convert_read_tags(name, value) ⇒ Array<Hash> | nil (private)
Read preference tags transformation.
# File 'lib/mongo/uri/options_mapper.rb', line 733
def (name, value) converted = convert_read_set(name, value) return unless converted [ converted ] end
#convert_repeated_bool(name, value) ⇒ Array<true | false> | nil (private)
Converts the value into a boolean and returns it wrapped in an array.
# File 'lib/mongo/uri/options_mapper.rb', line 362
def convert_repeated_bool(name, value) [ convert_bool(name, value) ] end
#convert_server_monitoring_mode(_name, value) ⇒ Symbol | nil (private)
::Mongo::Server monitoring mode transformation.
# File 'lib/mongo/uri/options_mapper.rb', line 708
def convert_server_monitoring_mode(_name, value) mode = value.downcase if SERVER_MONITORING_MODES.include?(mode) mode.to_sym else log_warn("#{value} is not a valid server monitoring mode") nil end end
#convert_symbol(_name, value) ⇒ Symbol (private)
Converts value into a symbol.
# File 'lib/mongo/uri/options_mapper.rb', line 516
def convert_symbol(_name, value) value.to_sym end
#convert_w(_name, value) ⇒ Integer | Symbol | String (private)
Converts value as a write concern.
If value is the word “majority”, returns the symbol :majority. If value is a number, returns the number as an integer. Otherwise returns the string value unchanged.
# File 'lib/mongo/uri/options_mapper.rb', line 778
def convert_w(_name, value) case value when 'majority' :majority when /\A[0-9]+\z/ value.to_i else value end end
#convert_zlib_compression_level(_name, value) ⇒ Integer | nil (private)
Parses the zlib compression level.
# File 'lib/mongo/uri/options_mapper.rb', line 819
def convert_zlib_compression_level(_name, value) i = if value.is_a?(String) && /\A-?\d+\z/ =~ value value.to_i elsif value.is_a?(Integer) value end if i && i >= -1 && i <= 9 i else log_warn("#{value} is not a valid zlibCompressionLevel") nil end end
#hash_extractor(name, value) ⇒ Hash (private)
Extract values from the string and put them into a nested hash.
# File 'lib/mongo/uri/options_mapper.rb', line 858
def hash_extractor(name, value) h = {} value.split(',').each do |tag| k, v = tag.split(':') if v.nil? log_warn("Invalid hash value for #{name}: key `#{k}` does not have a value: #{value}") next end h[k.to_sym] = v end if h.empty? nil else h end end
#merge_uri_option(target, value, name) (private)
Merges a new option into the target.
If the option exists at the target destination the merge will be an addition.
Specifically required to append an additional tag set to the array of tag sets without overwriting the original.
# File 'lib/mongo/uri/options_mapper.rb', line 237
def merge_uri_option(target, value, name) if target.key?(name) if REPEATABLE_OPTIONS.include?(name) target[name] += value else log_warn("Repeated option key: #{name}.") end else target.merge!(name => value) end end
#revert_array(value) ⇒ Array<String> (private)
Reverts an array.
# File 'lib/mongo/uri/options_mapper.rb', line 545
def revert_array(value) value end
#revert_auth_mech(value) ⇒ String (private)
Reverts auth mechanism.
# File 'lib/mongo/uri/options_mapper.rb', line 578
def revert_auth_mech(value) found = AUTH_MECH_MAP.detect do |_k, v| v == value end raise ArgumentError, "Unknown auth mechanism #{value}" unless found found.first end
#revert_auth_mech_props(value) ⇒ Hash | nil (private)
Reverts auth mechanism properties.
# File 'lib/mongo/uri/options_mapper.rb', line 619
def revert_auth_mech_props(value) value end
#revert_bool(value) ⇒ true | false | nil (private)
Reverts a boolean type.
# File 'lib/mongo/uri/options_mapper.rb', line 342
def revert_bool(value) value end
#revert_integer(value) ⇒ Integer | nil (private)
Reverts an integer.
# File 'lib/mongo/uri/options_mapper.rb', line 446
def revert_integer(value) value end
#revert_inverse_bool(value) ⇒ true | false | nil (private)
Reverts and inverts a boolean type.
# File 'lib/mongo/uri/options_mapper.rb', line 411
def revert_inverse_bool(value) value.nil? ? nil : !value end
#revert_max_staleness(value) ⇒ Integer | nil (private)
Reverts max staleness.
# File 'lib/mongo/uri/options_mapper.rb', line 669
def revert_max_staleness(value) value end
#revert_ms(value) ⇒ Integer (private)
Reverts an ms.
# File 'lib/mongo/uri/options_mapper.rb', line 497
def revert_ms(value) (value * 1000).round end
#revert_read_mode(value) ⇒ String (private)
Also known as: #stringify_read_mode
Reverts read mode.
# File 'lib/mongo/uri/options_mapper.rb', line 697
def revert_read_mode(value) value.to_s.gsub(/_(\w)/) { ::Regexp.last_match(1).upcase } end
#revert_read_tags(value) ⇒ Array<Hash> | nil (private)
Reverts read tags.
# File 'lib/mongo/uri/options_mapper.rb', line 745
def (value) value end
#revert_repeated_bool(value) ⇒ Array<true | false> | true | false | nil (private)
Reverts a repeated boolean type.
# File 'lib/mongo/uri/options_mapper.rb', line 371
def revert_repeated_bool(value) value end
#revert_symbol(value) ⇒ String (private)
Also known as: #stringify_symbol
Reverts a symbol.
# File 'lib/mongo/uri/options_mapper.rb', line 525
def revert_symbol(value) value.to_s end
#revert_w(value) ⇒ Integer | String (private)
Reverts write concern.
#revert_zlib_compression_level(value) ⇒ Integer | nil (private)
Reverts zlib compression level
# File 'lib/mongo/uri/options_mapper.rb', line 839
def revert_zlib_compression_level(value) value end
#ruby_to_smc(opts) ⇒ Hash
Converts Ruby options provided to “standardized MongoClient options”.
# File 'lib/mongo/uri/options_mapper.rb', line 117
def ruby_to_smc(opts) rv = {} URI_OPTION_MAP.each do |uri_key, spec| if spec[:group] v = opts[spec[:group]] v &&= v[spec[:name]] else v = opts[spec[:name]] end next if v.nil? if type = spec[:type] v = send("revert_#{type}", v) end canonical_key = URI_OPTION_CANONICAL_NAMES[uri_key] raise ArgumentError, "Option #{uri_key} is not known" unless canonical_key rv[canonical_key] = v end # For options that default to true, remove the value if it is true. %w[retryReads retryWrites].each do |k| rv.delete(k) if rv[k] end # Remove auth source when it is $external for mechanisms that default # (or require) that auth source. rv.delete('authSource') if %w[MONGODB-AWS].include?(rv['authMechanism']) && rv['authSource'] == '$external' # ssl and tls are aliases, remove ssl ones rv.delete('ssl') # TODO: remove authSource if it is the same as the database, # requires this method to know the database specified in the client. rv end
#ruby_to_string(opts) ⇒ Hash
Converts Ruby options provided to their representation in a ::Mongo::URI string.
# File 'lib/mongo/uri/options_mapper.rb', line 155
def ruby_to_string(opts) rv = {} URI_OPTION_MAP.each do |uri_key, spec| if spec[:group] v = opts[spec[:group]] v &&= v[spec[:name]] else v = opts[spec[:name]] end next if v.nil? if type = spec[:type] v = send("stringify_#{type}", v) end canonical_key = URI_OPTION_CANONICAL_NAMES[uri_key] raise ArgumentError, "Option #{uri_key} is not known" unless canonical_key rv[canonical_key] = v end # For options that default to true, remove the value if it is true. %w[retryReads retryWrites].each do |k| rv.delete(k) if rv[k] end # Remove auth source when it is $external for mechanisms that default # (or require) that auth source. rv.delete('authSource') if %w[MONGODB-AWS].include?(rv['authMechanism']) && rv['authSource'] == '$external' # ssl and tls are aliases, remove ssl ones rv.delete('ssl') # TODO: remove authSource if it is the same as the database, # requires this method to know the database specified in the client. rv end
#smc_to_ruby(opts)
# File 'lib/mongo/uri/options_mapper.rb', line 83
def smc_to_ruby(opts) = {} opts.each do |key, value| strategy = URI_OPTION_MAP[key.downcase] if strategy.nil? log_warn("Unsupported URI option '#{key}' on URI '#{@string}'. It will be ignored.") return end group = strategy[:group] target = if group [group] || {} else end value = apply_transform(key, value, strategy[:type]) # Sometimes the value here would be nil, for example if we are processing # read preference tags or auth mechanism properties and all of the # data within is invalid. Ignore such options. merge_uri_option(target, value, strategy[:name]) unless value.nil? [group] = target if group && !target.empty? && !.key?(group) end end
#stringify_array(value) ⇒ String (private)
Stringifies an array.
# File 'lib/mongo/uri/options_mapper.rb', line 554
def stringify_array(value) value.join(',') end
#stringify_auth_mech(value) ⇒ String | nil (private)
Stringifies auth mechanism.
# File 'lib/mongo/uri/options_mapper.rb', line 592
def stringify_auth_mech(value) revert_auth_mech(value) rescue StandardError nil end
#stringify_auth_mech_props(value) ⇒ String | nil (private)
Stringifies auth mechanism properties.
# File 'lib/mongo/uri/options_mapper.rb', line 628
def stringify_auth_mech_props(value) return if value.nil? value.map { |k, v| "#{k}:#{v}" }.join(',') end
#stringify_bool(value) ⇒ String | nil (private)
Stringifies a boolean type.
# File 'lib/mongo/uri/options_mapper.rb', line 351
def stringify_bool(value) revert_bool(value)&.to_s end
#stringify_integer(value) ⇒ String | nil (private)
Stringifies an integer.
# File 'lib/mongo/uri/options_mapper.rb', line 455
def stringify_integer(value) revert_integer(value)&.to_s end
#stringify_inverse_bool(value) ⇒ String | nil (private)
Inverts and stringifies a boolean.
# File 'lib/mongo/uri/options_mapper.rb', line 420
def stringify_inverse_bool(value) revert_inverse_bool(value)&.to_s end
#stringify_max_staleness(value) ⇒ String | nil (private)
Stringifies max staleness.
# File 'lib/mongo/uri/options_mapper.rb', line 678
def stringify_max_staleness(value) revert_max_staleness(value)&.to_s end
#stringify_ms(value) ⇒ String (private)
Stringifies an ms.
#stringify_read_mode(value) (private)
Alias for #revert_read_mode.
# File 'lib/mongo/uri/options_mapper.rb', line 700
alias stringify_read_mode revert_read_mode
#stringify_read_tags(value) ⇒ String | nil (private)
Stringifies read tags.
# File 'lib/mongo/uri/options_mapper.rb', line 754
def (value) value&.map { |ar| ar.map { |k, v| "#{k}:#{v}" }.join(',') } end
#stringify_repeated_bool(value) ⇒ Array<true | false> | nil (private)
Stringifies a repeated boolean type.
# File 'lib/mongo/uri/options_mapper.rb', line 380
def stringify_repeated_bool(value) rep = revert_repeated_bool(value) if rep&.is_a?(Array) rep.join(',') else rep end end
#stringify_server_monitoring_mode(value) ⇒ String (private)
Stringifies server monitoring mode.
# File 'lib/mongo/uri/options_mapper.rb', line 723
def stringify_server_monitoring_mode(value) value.to_s end
#stringify_symbol(value) (private)
Alias for #revert_symbol.
# File 'lib/mongo/uri/options_mapper.rb', line 528
alias stringify_symbol revert_symbol
#stringify_w(value) ⇒ String (private)
Stringifies write concern.
#stringify_zlib_compression_level(value) ⇒ String | nil (private)
Stringifies zlib compression level
# File 'lib/mongo/uri/options_mapper.rb', line 848
def stringify_zlib_compression_level(value) revert_zlib_compression_level(value)&.to_s end