devise

https://github.com/plataformatec/devise

Ruby

Flexible authentication solution for Rails with Warden.

Mail::Message#method_missing

Method Missing in this implementation allows you to set any of the
standard fields directly as you would the "to", "subject" etc.

Those fields used most often (to, subject et al) are given their
own method for ease of documentation and also to avoid the hook
call to method missing.

This will only catch the known fields listed in:

 Mail::Field::KNOWN_FIELDS

as per RFC 2822, any ruby string or method name could pretty much
be a field name, so we don't want to just catch ANYTHING sent to
a message object and interpret it as a header.

This method provides all three types of header call to set, read
and explicitly set with the = operator

Examples:

 mail.comments = 'These are some comments'
 mail.comments #=> 'These are some comments'

 mail.comments 'These are other comments'
 mail.comments #=> 'These are other comments'


 mail.date = 'Tue, 1 Jul 2003 10:52:37 +0200'
 mail.date.to_s #=> 'Tue, 1 Jul 2003 10:52:37 +0200'

 mail.date 'Tue, 1 Jul 2003 10:52:37 +0200'
 mail.date.to_s #=> 'Tue, 1 Jul 2003 10:52:37 +0200'


 mail.resent_msg_id = '<1234@resent_msg_id.lindsaar.net>'
 mail.resent_msg_id #=> '<1234@resent_msg_id.lindsaar.net>'

 mail.resent_msg_id '<4567@resent_msg_id.lindsaar.net>'
 mail.resent_msg_id #=> '<4567@resent_msg_id.lindsaar.net>'

Source | Google | Stack overflow

Edit

git clone [email protected]:plataformatec/devise.git

cd devise

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Mail--Message-method_missing-for-pr


# Commit to git

git add git commit -m "better docs for Mail::Message#method_missing"


# 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--Message-method_missing-for-pr

hub pull-request


# Celebrate!