Class: EmailDomainChecker::DnsResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/email_domain_checker/dns_resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout: 5, cache: nil) ⇒ DnsResolver

Returns a new instance of DnsResolver.



10
11
12
13
# File 'lib/email_domain_checker/dns_resolver.rb', line 10

def initialize(timeout: 5, cache: nil)
  @timeout = timeout
  @cache = cache
end

Instance Attribute Details

#timeoutObject (readonly)

Returns the value of attribute timeout.



8
9
10
# File 'lib/email_domain_checker/dns_resolver.rb', line 8

def timeout
  @timeout
end

Instance Method Details

#has_a_record?(domain) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/email_domain_checker/dns_resolver.rb', line 19

def has_a_record?(domain)
  has_record?(domain, "a", Resolv::DNS::Resource::IN::A)
end

#has_mx_record?(domain) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/email_domain_checker/dns_resolver.rb', line 15

def has_mx_record?(domain)
  has_record?(domain, "mx", Resolv::DNS::Resource::IN::MX)
end