factory_girl

https://github.com/thoughtbot/factory_girl

Ruby

A library for setting up Ruby objects as test data.

Mail::Address#initialize

Mail::Address handles all email addresses in Mail.  It takes an email address string
and parses it, breaking it down into its component parts and allowing you to get the
address, comments, display name, name, local part, domain part and fully formatted
address.

Mail::Address requires a correctly formatted email address per RFC2822 or RFC822.  It
handles all obsolete versions including obsolete domain routing on the local part.

 a = Address.new('Mikel Lindsaar (My email address) <[email protected]>')
 a.format       #=> 'Mikel Lindsaar <[email protected]> (My email address)'
 a.address      #=> '[email protected]'
 a.display_name #=> 'Mikel Lindsaar'
 a.local        #=> 'mikel'
 a.domain       #=> 'test.lindsaar.net'
 a.comments     #=> ['My email address']
 a.to_s         #=> 'Mikel Lindsaar <[email protected]> (My email address)'

Source | Google | Stack overflow

Edit

git clone [email protected]:thoughtbot/factory_girl.git

cd factory_girl

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Mail--Address-initialize-for-pr


# Commit to git

git add git commit -m "better docs for Mail::Address#initialize"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Mail--Address-initialize-for-pr

hub pull-request


# Celebrate!