Like any other method in Ruby (or virtually any object-oriented language),
a === b
means that any class of class a wants this to mean.
However, if you do not want to confuse your colleagues, the agreement is that === is a subobject operator. Basically, this is a logical operator that asks the question "If I have a box labeled a , does it make sense to put b in this box?"
Alternative wording: "If a described a set, could b be a member of this set?"
For example:
(1..5) === 3
The main use for the === operator is in case expressions, since
case foo when bar baz when quux flurb else blarf end
translate to something (approximately), for example
_temp = foo if bar === _temp baz elsif quux === _temp flurb else blarf end
Note that if you want to find this operator, it is usually called the triple equality operator or the three-dimensional operator or the equality operator. I really do not like these names, because this operator has absolutely nothing to do with equality.
In particular, one would expect the equality to be symmetric: if a is equal to b , then b better to be equal to a . In addition, one would expect equality to be transitive: if a == b and b == c , then a == c . Although it is actually impossible to guarantee that in a unified mailing language such as Ruby, you should at least make an effort to preserve this property (for example, following the coerce protocol).
However, for === there is no expectation of either symmetry or transitivity. In fact, this is not very design, not symmetrical. That is why I do not like to call it something that even remotely resembles equality. This is also why I think it should have been called something else, like ~~~ or something else.