devise

https://github.com/plataformatec/devise

Ruby

Flexible authentication solution for Rails with Warden.

Mail::Header#[]

3.6. Field definitions
 
  The following table indicates limits on the number of times each
  field may occur in a message header as well as any special
  limitations on the use of those fields.  An asterisk next to a value
  in the minimum or maximum column indicates that a special restriction
  appears in the Notes column.

  <snip table from 3.6>

As per RFC, many fields can appear more than once, we will return a string
of the value if there is only one header, or if there is more than one 
matching header, will return an array of values in order that they appear
in the header ordered from top to bottom.

Example:

 h = Header.new
 h.fields = ['To: [email protected]', 'X-Mail-SPAM: 15', 'X-Mail-SPAM: 20']
 h['To']          #=> '[email protected]'
 h['X-Mail-SPAM'] #=> ['15', '20']

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--Header----for-pr


# Commit to git

git add git commit -m "better docs for Mail::Header#[]"


# 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--Header----for-pr

hub pull-request


# Celebrate!