Class: EmailInquire::Validator::CommonlyMistakenTld
- Defined in:
- lib/email_inquire/validator/commonly_mistaken_tld.rb
Constant Summary collapse
- MISTAKES =
{ ".combr" => ".com.br", ".cojp" => ".co.jp", ".couk" => ".co.uk", ".com.com" => ".com", }.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from EmailInquire::Validator::Base
Instance Method Details
#validate ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/email_inquire/validator/commonly_mistaken_tld.rb', line 16 def validate mistake, reference = MISTAKES.find do |mistake, reference| next if !mistake.end_with?(reference) && domain.end_with?(reference) domain.end_with?(mistake) end response.hint!(domain: domain.sub(/#{mistake}\z/, reference)) if reference end |