lib/mongo/client.rb
# Validates options in the provided argument for validity.
# The argument may contain a subset of options that the client will
# eventually have; this method validates each of the provided options
# but does not check for interactions between combinations of options.
Validates options in the provided argument for validity.
The argument may contain a subset of options that the client will
eventually have; this method validates each of the provided options
but does not check for interactions between combinations of options.
Validates options in the provided argument for validity . The argument may contain a subset of options that the client will eventually have ; this method validates each of the provided options but does not check for interactions between combinations of options .
def validate_new_options!(opts = Options::Redacted.new)
      return Options::Redacted.new unless opts
      Lint.validate_underscore_read_preference(opts[:read])
      Lint.validate_read_concern_option(opts[:read_concern])
      opts.each.inject(Options::Redacted.new) do |_options, (k, v)|
        key = k.to_sym
        if VALID_OPTIONS.include?(key)
          validate_max_min_pool_size!(key, opts)
          validate_read!(key, opts)
          if key == :compressors
            compressors = valid_compressors(v)
            _options[key] = compressors unless compressors.empty?
          else
            _options[key] = v
          end
        else
          log_warn("Unsupported client option '#{k}'. It will be ignored.")
        end
        _options
      end
    end
def validate_new_options! ( opts = Options :: Redacted . new ) return Options :: Redacted . new unless opts Lint . validate_underscore_read_preference ( opts [ :read ] ) Lint . validate_read_concern_option ( opts [ :read_concern ] ) opts . each . inject ( Options :: Redacted . new ) do | _options , ( k , v ) | key = k . to_sym if VALID_OPTIONS . include? ( key ) validate_max_min_pool_size! ( key , opts ) validate_read! ( key , opts ) if key == :compressors compressors = valid_compressors ( v ) _options [ key ] = compressors unless compressors . empty? else _options [ key ] = v end else log_warn ( "Unsupported client option '#{k}'. It will be ignored." ) end _options end end
Validates options in the provided argument for validity.
Validates options in the provided argument for validity .
opts
new