Class: Walid::EmailValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Walid::EmailValidator
- Defined in:
- lib/walid/email_validator.rb
Overview
Validate email adresses
Validate email addresses based on RFC5321 and RFC5322 (with updates)
Options:
-
quotes (default: false) - allow quotings in local part (i.e. lo.“lol”)
-
utf (default: false) - allow UTF-8 characters in address
-
ip (default: false) - allow IP addresses as domain part
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
12 13 14 15 16 |
# File 'lib/walid/email_validator.rb', line 12 def validate_each(record, attribute, value) @local, _, @domain = value.rpartition('@') record.errors.add(attribute, 'Invalid email format.') if check_local end |