Class: EmailInquire::Validator::EmailFormat

Inherits:
Base
  • Object
show all
Defined in:
lib/email_inquire/validator/email_format.rb

Constant Summary collapse

DOMAIN_REGEXP =
/
  \A
  (?:
    (?=
      [a-z0-9-]{1,63}
      \.
    )
    [a-z0-9]+
    (?:
      -
      [a-z0-9]+
    )*
    \.
  ){1,8}
  [a-z]{2,63}
  \z
/x.freeze
NAME_ALLOWED_CHARS =
/[a-z0-9._%+-]/.freeze
NAME_REGEXP =
/
  \A
  [a-z0-9]
  [#{NAME_ALLOWED_CHARS}]{0,63}
  \z
/x.freeze

Instance Attribute Summary

Attributes inherited from Base

#domain, #email, #name

Instance Method Summary collapse

Methods inherited from Base

#initialize, validate

Constructor Details

This class inherits a constructor from EmailInquire::Validator::Base

Instance Method Details

#validateObject



40
41
42
# File 'lib/email_inquire/validator/email_format.rb', line 40

def validate
  response.invalid! if !email || email.length > 255 || !name_valid? || !domain_valid?
end