Class: EmailInquire::Validator::CommonlyMistakenDomain

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

Constant Summary collapse

MISTAKES =
{
  /google(?!mail)/ => "gmail.com",
  /windows.*\.com/ => "live.com",
}.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



14
15
16
17
18
19
20
21
22
23
# File 'lib/email_inquire/validator/commonly_mistaken_domain.rb', line 14

def validate
  return response.valid! if MISTAKES.value?(domain)

  _mistake, reference =
    MISTAKES.find do |mistake, _reference|
      mistake =~ domain
    end

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