lib/mongo/uri/options_mapper.rb
# 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.
#
# @param [ String ] key URI option name.
# @param [ String ] value The value of the option.
# @param [ Hash ] uri_options The base option target.
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.
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 .
def add_uri_option(key, value, uri_options)
        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
          uri_options[group] || {}
        else
          uri_options
        end
        value = apply_transform(key, value, strategy[:type])
        unless value.nil?
          merge_uri_option(target, value, strategy[:name])
        end
        if group && !target.empty? && !uri_options.key?(group)
          uri_options[group] = target
        end
      end
def add_uri_option ( key , value , uri_options ) 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 uri_options [ group ] || { } else uri_options end value = apply_transform ( key , value , strategy [ :type ] ) unless value . nil? merge_uri_option ( target , value , strategy [ :name ] ) end if group && ! target . empty? && ! uri_options . key? ( group ) uri_options [ group ] = target end end
Adds an option to the uri options hash.
Adds an option to the uri options hash .
# 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.
key
value
uri_options
uri_options The base option target.
uri_options The base option target .