Class: Email
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Includes:
- Labelize
- Defined in:
- app/models/email.rb
Constant Summary collapse
- VALID_EMAIL_FORMAT_REGEX =
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.canonicalize(addr) ⇒ Object
12 13 14 15 |
# File 'app/models/email.rb', line 12 def self.canonicalize(addr) candidate = addr.strip.downcase if not addr.blank? candidate ||= addr end |
.valid_format?(addr) ⇒ Boolean
21 22 23 |
# File 'app/models/email.rb', line 21 def self.valid_format?(addr) return (addr =~ VALID_EMAIL_FORMAT_REGEX) != nil end |