Sha256: 97a1adfc00806748266f23f28210c847704a04da424cafe38d216bca86839974

Contents?: true

Size: 309 Bytes

Versions: 1

Compression:

Stored size: 309 Bytes

Contents

module Citizenship
  EMAIL_REGEXP = /\A[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+\z/i

  def self.valid_email!(email)
    raise EmailError, :invalid_email unless email.match(EMAIL_REGEXP)
    email
  end

  def self.valid_email?(email)
    valid_email!(email)
    true
  rescue EmailError
    false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citizenship-1.0.0 lib/citizenship/email.rb