Class: Ubi::Memoria::Email
Overview
An Electronic Mail
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.regex(_hint) ⇒ Object
Email regex.
Instance Method Summary collapse
-
#initialize(text, _hint = nil, opts = {}) ⇒ Email
constructor
Clean up regex on init.
Methods inherited from Base
#==, extract_text, #format, inherited, key, name, parse, parse!, #parser, plural, #to_s
Constructor Details
#initialize(text, _hint = nil, opts = {}) ⇒ Email
Clean up regex on init
8 9 10 11 12 13 |
# File 'lib/ubi/memorias/email.rb', line 8 def initialize(text, _hint = nil, opts = {}) text = text.downcase.gsub(/^\(|\.$/, '') @text = text # @addr = text @opts = opts end |
Class Method Details
.regex(_hint) ⇒ Object
Email regex
23 24 25 26 27 28 29 30 |
# File 'lib/ubi/memorias/email.rb', line 23 def regex(_hint) %r{ ([a-z0-9!#$%&'*+/=?^_`{|}~-]+ (?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@ (?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+ (?:[a-z0-9-]*[a-z0-9])?)(?:\W|\s|$) }x end |