Method: Mongo::Srv::Resolver#initialize

Defined in:
lib/mongo/srv/resolver.rb

#initialize(**opts) ⇒ Resolver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new Resolver.

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (**opts):

  • :timeout (Float)

    The timeout, in seconds, to use for each DNS record resolution.

  • :raise_on_invalid (Boolean)

    Whether or not to raise an exception if either a record with a mismatched domain is found or if no records are found. Defaults to true.

  • :resolv_options (Hash)

    For internal driver use only. Options to pass through to Resolv::DNS constructor for SRV lookups.



51
52
53
54
55
# File 'lib/mongo/srv/resolver.rb', line 51

def initialize(**opts)
  @options = opts.freeze
  @resolver = Resolv::DNS.new(@options[:resolv_options])
  @resolver.timeouts = timeout
end