Class: EmailRepair::Mechanic::CommonDomainPeriodAdder

Inherits:
CommonDomainRepair show all
Defined in:
lib/email_repair/mechanic.rb

Class Method Summary collapse

Methods inherited from CommonDomainRepair

common_domains

Class Method Details

.repair(email) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/email_repair/mechanic.rb', line 88

def self.repair(email)
  common_domains.each do |name, suffix|
    regex = /#{name}#{suffix}$/
    email = email.sub(regex, "#{name}.#{suffix}") if email.match(regex)
  end
  email
end