devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
Mail::Message#==
Two emails are the same if they have the same fields and body contents. One
gotcha here is that Mail will insert Message-IDs when calling encoded, so doing
mail1.encoded == mail2.encoded is most probably not going to return what you think
as the assigned Message-IDs by Mail (if not already defined as the same) will ensure
that the two objects are unique, and this comparison will ALWAYS return false.
So the == operator has been defined like so: Two messages are the same if they have
the same content, ignoring the Message-ID field, unless BOTH emails have a defined and
different Message-ID value, then they are false.
So, in practice the == operator works like this:
m1 = Mail.new("Subject: Hello\r\n\r\nHello")
m2 = Mail.new("Subject: Hello\r\n\r\nHello")
m1 == m2 #=> true
m1 = Mail.new("Subject: Hello\r\n\r\nHello")
m2 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m1 == m2 #=> true
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m2 = Mail.new("Subject: Hello\r\n\r\nHello")
m1 == m2 #=> true
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m2 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m1 == m2 #=> true
m1 = Mail.new("Message-ID: <1234@test>\r\nSubject: Hello\r\n\r\nHello")
m2 = Mail.new("Message-ID: <DIFFERENT@test>\r\nSubject: Hello\r\n\r\nHello")
m1 == m2 #=> falseEdit
git clone [email protected]:plataformatec/devise.git
cd devise
open
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Mail--Message----for-pr
# Commit to gitgit add git commit -m "better docs for Mail::Message#=="
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Mail--Message----for-pr
hub pull-request
# Celebrate!