Class: EmailInquire::Validator::CommonProviderMistake
- Defined in:
- lib/email_inquire/validator/common_provider_mistake.rb
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
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/email_inquire/validator/common_provider_mistake.rb', line 11 def validate return if CommonProvider::DOMAINS.include?(domain) replacement_domain = CommonProvider::DOMAINS.find do |reference| distance = DamerauLevenshtein.distance(domain, reference) distance.equal?(1) end response.hint!(domain: replacement_domain) if replacement_domain end |