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



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

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