Project

ruby_email

0.0
No release in over 3 years
Low commit activity in last 3 years
A RFC compliant email validator
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.1.1, ~> 1
 Project Readme

A RFC compliant Email validator

Build Status

Installation

gem install ruby_email

or in the Gemfile

gem 'ruby_email'

Usage in Ruby

require 'ruby_email'

# Pure Rfc5322
RubyEmail::Rfc5322.validates? "toto@tata" # => true
RubyEmail::Rfc5322.match "toto@tata" # => #<MatchData "toto@tata" local:"toto" domain:"tata">
RubyEmail::Rfc5322.validates? "toto" # => false
RubyEmail::Rfc5322.match "toto" # => nil

# Rfc5322 + Internet basic usage
RubyEmail::Rfc5322::Public.validates? "toto@tata.com" # => true
RubyEmail::Rfc5322::Public.match "toto@tata.com" # => #<MatchData "toto@tata" local:"toto" domain:"tata.com">

# Rfc5322 Strings
require 'ruby_email/rfc5322/string'
"local@domain".is_email? # => true
"local".is_email? # => false

# Rfc5322 Strings + Internet basic usage
require 'ruby_email/rfc5322/public/string'
"local@domain.root".is_public_email? # => true
"local@domain".is_public_email? # => false

Usage in Ruby on Rails

class Model < ActiveRecord::Base
  # validates :email, format: RubyEmail::Rfc5322::REGEXP # valid on an intranet ...
  validates :email, format: RubyEmail::Rfc5322::Public::REGEXP
end

Unitary tests

rake test

Contributes !

Find a bug ? Want a new feature ? Create a clear pull request and we'll see :)