lib/netchk/dns_resolv_verifier.rb in netchk-0.0.1.beta vs lib/netchk/dns_resolv_verifier.rb in netchk-0.0.1

- old
+ new

@@ -1,13 +1,14 @@ # frozen_string_literal: true module Netchk class DNSResolvVerifier - def initialize - @domains = %w[google.com facebook.com] + def initialize(**options) + @domains = options['domains'] || %w[google.com youtube.com facebook.com] + @resolv_conf = options['resolv.conf'] end def verify - ::Resolv::DNS.open do |dns| + ::Resolv::DNS.open(@resolv_conf) do |dns| @domains.each do |domain| begin dns.getaddress(domain) rescue ::Resolv::ResolvError $stderr.puts "Failed to resolve #{domain}"