New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rfc822

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc822

  • 0.1.5
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

= Introduction

This is a simple gem for Ruby that simplifies validating email addresses. It conforms with RFC2822.

Here comes a quick code sample. Currently no docs.

require 'rfc822'

To test if whole string is an email... ugly way

(returns 0 on success, nil on failure):

"tom@example.com" =~ RFC822::EMAIL_REGEXP_WHOLE

or nice one (returns true/false):

"tom@example.com".is_email?

To test if string contains an email... ugly way

(returns 0 on success, nil on failure):

"demo john@example.comFooBar" =~ RFC822::EMAIL_REGEXP_PART

or nice one (returns true/false):

"demo john@example.comFooBar".contains_email?

To scan for emails within a string... ugly way

(returns an array):

"something a@example.com xyz".scan(RFC822::EMAIL_REGEXP_PART)

or nice one (also returns an array):

"something a@example.com xyz".scan_for_emails

= Installation

=== Ruby Versions

Code was tested with ruby-1.8.7-p334 [ i386 ] and ruby-1.9.2-p180 [ i386 ] under RVM.

=== Gems

The gems are hosted at Rubygems.org[http://rubygems.org]. Make sure you're using the latest version of rubygems:

$ gem update --system

Then you can install the gem as follows:

$ gem install rfc822

=== Bundler

Add to your Gemfile:

gem "rfc822"

and then type:

bundle install

=== From the GitHub source

The source code is available at http://github.com/saepia/rfc822. You can either clone the git repository or download a tarball or zip file. Once you have the source, you can unpack it and use from wherever you downloaded.

= ChangeLog === 0.1.5

  • Fixed bug that caused to change encoding of string passed to the methods (thanks to Artur Trzop)

=== 0.1.4

  • Fixed regression introduced in 0.1.3 that caused EMAIL_REGEXP_WHOLE to stop working properly.

=== 0.1.3 (yanked)

  • [security] Updated regular expressions to use \A and \z instead of ^ and $ operators.

=== 0.1.2

  • Updated license

=== 0.1.1

  • Fixed description in the gem description

=== 0.1.0

  • Added compatibility with Ruby 1.9
  • Added String#is_email?, String#contains_email? and String#scan_for_emails methods

=== 0.0.2

  • Initial release

= License

MIT

FAQs

Package last updated on 18 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc