| Class | Mongo::Options::Redacted |
| In: |
lib/mongo/options/redacted.rb
|
| Parent: | BSON::Document |
Class for wrapping options that could be sensitive. When printed, the sensitive values will be redacted.
@since 2.1.0
| SENSITIVE_OPTIONS | = | [ :password, :pwd ].freeze |
The options whose values will be redacted.
@since 2.1.0 |
|
| STRING_REPLACEMENT | = | '<REDACTED>'.freeze |
The replacement string used in place of the value for sensitive keys.
@since 2.1.0 |
Whether these options contain a given key.
@example Determine if the options contain a given key.
options.has_key?(:name)
@param [ String, Symbol ] key The key to check for existence.
@return [ true, false ] If the options contain the given key.
@since 2.1.0
Get a string representation of the options.
@return [ String ] The string representation of the options.
@since 2.1.0
Returns a new options object consisting of pairs for which the block returns false.
@example Get a new options object with pairs for which the block returns false.
new_options = options.reject { |k, v| k == 'database' }
@yieldparam [ String, Object ] The key as a string and its value.
@return [ Options::Redacted ] A new options object.
@since 2.1.0
Only keeps pairs for which the block returns false.
@example Remove pairs from this object for which the block returns true.
options.reject! { |k, v| k == 'database' }
@yieldparam [ String, Object ] The key as a string and its value.
@return [ Options::Redacted, nil ] This object or nil if no changes were made.
@since 2.1.0
Returns a new options object consisting of pairs for which the block returns true.
@example Get a new options object with pairs for which the block returns true.
ssl_options = options.select { |k, v| k =~ /ssl/ }
@yieldparam [ String, Object ] The key as a string and its value.
@return [ Options::Redacted ] A new options object.
@since 2.1.0
Only keeps pairs for which the block returns true.
@example Remove pairs from this object for which the block does not return true.
options.select! { |k, v| k =~ /ssl/ }
@yieldparam [ String, Object ] The key as a string and its value.
@return [ Options::Redacted, nil ] This object or nil if no changes were made.
@since 2.1.0