1

Possible Duplicate:
=== vs. == in Ruby

I can't find verbose docs on this at all. The doc page is broken:

http://ruby-doc.org/core-1.9.3/String.html

The regex page uses the word "case" in two different senses (!) and I can't understand what the point is:

http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-i-3D-3D-3D

And it was in use in Rails:

https://github.com/rails/rails/commit/3756a3fdfe8d339a53bf347487342f93fd9e1edb?utm_source=rubyweekly&utm_medium=email

Community
  • 1
  • 1
Dogweather
  • 15,512
  • 17
  • 62
  • 81

1 Answers1

2

=== is the "case equality" operator:

In Ruby, triple equals (Object#===) is, "effectively the same as calling #==, but typically overridden by descendants to provide meaningful semantics in case statements".

See http://andy-payne.com/2008/09/confusion-over-triple-equals/

user229044
  • 232,980
  • 40
  • 330
  • 338