Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Resolv::DNS.open
(*untyped args) -> instance
(*untyped args) { (instance) -> void } -> void
open(*args) { |dns| ... }
lib/resolv.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/resolv.rb, line 301
def self.open(*args)
dns = new(*args)
return dns unless block_given?
begin
yield dns
ensure
dns.close
end
end
Creates a new DNS resolver. See Resolv::DNS.new for argument details.
Yields the created DNS resolver to the block, if given, otherwise returns it.