Class: EmailInquire::Validator::UniqueDomainProvider

Inherits:
Base
  • Object
show all
Defined in:
lib/email_inquire/validator/unique_domain_provider.rb

Constant Summary collapse

DOMAINS =
load_data("unique_domain_providers").freeze

Instance Attribute Summary

Attributes inherited from Base

#domain, #email, #name

Instance Method Summary collapse

Methods inherited from Base

#initialize, validate

Constructor Details

This class inherits a constructor from EmailInquire::Validator::Base

Instance Method Details

#validateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/email_inquire/validator/unique_domain_provider.rb', line 11

def validate
  return response.valid! if DOMAINS.include?(domain)

  base, _tld = domain.split(".", 2)

  replacement_domain =
    DOMAINS.find do |reference|
      reference_base, _reference_tld = reference.split(".")

      reference_base.eql?(base)
    end

  response.hint!(domain: replacement_domain) if replacement_domain
end