Skip to content
instance method

Set#===

(untyped other) -> bool
===(p1)

Alias of #include?

Returns true if the set contains the given object:

Example
Set[1, 2, 3].include? 2   #=> true
Set[1, 2, 3].include? 4   #=> false

Note that include? and member? do not test member equality using == as do other Enumerables.

This is aliased to ===, so it is usable in case expressions:

Example
case :apple
when Set[:potato, :carrot]
  "vegetable"
when Set[:apple, :banana]
  "fruit"
end
# => "fruit"

See also Enumerable#include?

See also #include? #== #> #<=> also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0