summaryrefslogtreecommitdiff
path: root/lib/resolv.rb
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2023-11-24 18:25:12 -0800
committerHiroshi SHIBATA <[email protected]>2024-12-13 10:54:48 +0900
commitf0f9e2f50c7b19a311a421b2dc7ddfea6bbb2a28 ()
treee6fe1e5599d02fd3ee4a19a5a81207d194d86a0f /lib/resolv.rb
parent0ea5c13bc6c4707aa8d2dce9b0c5af7513fb5f66 (diff)
[ruby/resolv] Allow setting default Resolv::DNS config in Resolv.new
If a positional argument is provided, the use_ipv6 keyword option is ignored: ```ruby Resolv.new([Resolv::DNS.new], use_ipv6: false) ``` Issue a warning in this case. Currently, you have to pass a positional hash argument to set the DNS config. However, after support for the use_ipv6 keyword argument is removed, you will be able to pass either a positional hash or keyword arguments. Code that was just specifying the use_ipv6 keyword optional will still work correctly in that case. https://.com/ruby/resolv/commit/5ff9dda991
-rw-r--r--lib/resolv.rb17
1 files changed, 15 insertions, 2 deletions
@@ -79,9 +79,22 @@ class Resolv
##
# Creates a new Resolv using +resolvers+.
- def initialize(resolvers=nil, use_ipv6: nil)
- @resolvers = resolvers || [Hosts.new, DNS.new(DNS::Config.default_config_hash.merge(use_ipv6: use_ipv6))]
end
##