Class: SignalApi::EmailAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/signal_api/util/email_address.rb

Class Method Summary collapse

Class Method Details

.valid?(email) ⇒ Boolean

Check to see if an email address is valid

Returns:

  • (Boolean)


5
6
7
# File 'lib/signal_api/util/email_address.rb', line 5

def self.valid?(email)
  email && !email.strip.empty? && email.strip =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
end