Module: CustomEmailValidator

Defined in:
lib/useful_validators/custom_email_validator.rb

Class Method Summary collapse

Class Method Details

.domain_head_regexObject



12
13
14
# File 'lib/useful_validators/custom_email_validator.rb', line 12

def domain_head_regex
  '(?:[A-Z0-9\-]+\.)+'.freeze
end

.domain_tld_regexObject



16
17
18
# File 'lib/useful_validators/custom_email_validator.rb', line 16

def domain_tld_regex
  '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
end

.email_name_regexObject



8
9
10
# File 'lib/useful_validators/custom_email_validator.rb', line 8

def email_name_regex
  '[\w\.%\+\-]+'.freeze
end

.email_regexObject



4
5
6
# File 'lib/useful_validators/custom_email_validator.rb', line 4

def email_regex
  /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
end