Class: EmailRepair::Mechanic::CommonDomainAtAdder
- Inherits:
-
CommonDomainRepair
- Object
- CommonDomainRepair
- EmailRepair::Mechanic::CommonDomainAtAdder
- Defined in:
- lib/email_repair/mechanic.rb
Class Method Summary collapse
Methods inherited from CommonDomainRepair
Class Method Details
.repair(email) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/email_repair/mechanic.rb', line 98 def self.repair(email) common_domains.each do |name, suffix| punc_regex = /[.#-]#{name}.#{suffix}$/ if email.match(punc_regex) email = email.sub(punc_regex, "@#{name}.#{suffix}") elsif email.match?(/[^@]#{name}.#{suffix}$/) email = email.sub(/#{name}.#{suffix}$/, "@#{name}.#{suffix}") end end email end |