From 23c1d9fac73c606f01e0e3d929c7d2938670ff05 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Wed, 20 May 2026 17:36:23 +0900 Subject: [PATCH] Fix Resolv#initialize signature: array of resolvers + use_ipv6: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Resolv#initialize` took `?Resolv::Hosts | Resolv::DNS resolvers`, which is wrong on two counts, both visible in this file's own RD doc (`new(resolvers=..., use_ipv6: ...)`): - `resolvers` is the resolver *list*, not a single resolver — Ruby's implementation iterates it (`@resolvers.each`). Passing one resolver object fails at runtime. It accepts an Array of resolver objects, a Hash (used as DNS-resolver configuration, per the doc), or nil. - the `use_ipv6:` keyword was missing from the signature entirely. --- stdlib/resolv/0/resolv.rbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/resolv/0/resolv.rbs b/stdlib/resolv/0/resolv.rbs index 479c0ef13..4798ef8f2 100644 --- a/stdlib/resolv/0/resolv.rbs +++ b/stdlib/resolv/0/resolv.rbs @@ -134,7 +134,7 @@ class Resolv # DNS resolver. If `resolvers` is a hash, uses the hash as configuration for # the DNS resolver. # - def initialize: (?Resolv::Hosts | Resolv::DNS resolvers) -> untyped + def initialize: (?(Array[Resolv::Hosts | Resolv::DNS] | Hash[Symbol, untyped])? resolvers, ?use_ipv6: bool?) -> untyped end #