Method: Mongo::Options::Redacted#select

Defined in:
lib/mongo/options/redacted.rb

#select {|The| ... } ⇒ Options::Redacted

Returns a new options object consisting of pairs for which the block returns true.

Examples:

Get a new options object with pairs for which the block returns true.

ssl_options = options.select { |k, v| k =~ /ssl/ }

Yield Parameters:

  • The (String, Object)

    key as a string and its value.

Returns:

Since:

  • 2.1.0



118
119
120
121
# File 'lib/mongo/options/redacted.rb', line 118

def select(&block)
  new_options = dup
  new_options.select!(&block) || new_options
end