Class: CC::Resolv
- Inherits:
-
Object
- Object
- CC::Resolv
- Defined in:
- lib/cc/resolv.rb
Defined Under Namespace
Classes: Fixed
Class Method Summary collapse
Class Method Details
.with_fixed_dns(dns = ::Resolv::DNS.new) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cc/resolv.rb', line 5 def self.with_fixed_dns(dns = ::Resolv::DNS.new) ::Resolv::DefaultResolver.replace_resolvers([Fixed.new(dns)]) yield if block_given? ensure # There's no way to ask what the current values are before we override # them; hopefully going by the source is good enough. # https://docs.ruby-lang.org/en/2.0.0/Resolv.html#method-c-new default_resolvers = [::Resolv::Hosts.new, ::Resolv::DNS.new] ::Resolv::DefaultResolver.replace_resolvers(default_resolvers) end |