Class: RichEmailValidator::EmailValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/rich_email_validator/email_validator.rb

Overview

Validate email address

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email) ⇒ EmailValidator

Validates an email

Parameters:

  • email (String)


29
30
31
# File 'lib/rich_email_validator/email_validator.rb', line 29

def initialize(email)
  @email = email
end

Class Attribute Details

.email_regexpObject



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

#emailObject (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

Returns:

  • (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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


47
48
49
# File 'lib/rich_email_validator/email_validator.rb', line 47

def valid_mx_record?
  @validate_mx_record ||= check_mx_record
end