Class: RichEmailValidator::EmailValidator
- Inherits:
-
Object
- Object
- RichEmailValidator::EmailValidator
- Defined in:
- lib/rich_email_validator/email_validator.rb
Overview
Validate email address
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(email) ⇒ EmailValidator
constructor
Validates an email.
-
#valid? ⇒ Boolean
Validates an email.
-
#valid_form? ⇒ Boolean
Validates an email.
-
#valid_mx_record? ⇒ Boolean
Validates an email.
Constructor Details
#initialize(email) ⇒ EmailValidator
Validates an email
29 30 31 |
# File 'lib/rich_email_validator/email_validator.rb', line 29 def initialize(email) @email = email end |
Class Attribute Details
.email_regexp ⇒ Object
13 14 15 |
# File 'lib/rich_email_validator/email_validator.rb', line 13 def email_regexp @email_regexp || default_email_regexp end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
25 26 27 |
# File 'lib/rich_email_validator/email_validator.rb', line 25 def email @email end |
Class Method Details
.valid?(email) ⇒ Boolean
9 10 11 |
# File 'lib/rich_email_validator/email_validator.rb', line 9 def valid?(email) new(email).valid? end |
Instance Method Details
#valid? ⇒ Boolean
Validates an email
35 36 37 |
# File 'lib/rich_email_validator/email_validator.rb', line 35 def valid? @valid ||= valid_form? && valid_mx_record? end |
#valid_form? ⇒ Boolean
Validates an email
41 42 43 |
# File 'lib/rich_email_validator/email_validator.rb', line 41 def valid_form? @valid_form ||= check_form end |
#valid_mx_record? ⇒ Boolean
Validates an email
47 48 49 |
# File 'lib/rich_email_validator/email_validator.rb', line 47 def valid_mx_record? @validate_mx_record ||= check_mx_record end |