method

===

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: Set
===(o) public

Returns true if the given object is a member of the set, and false otherwise.

Used in case statements:

require 'set'

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

Or by itself:

Set[1, 2, 3] === 2   #=> true
Set[1, 2, 3] === 4   #=> false
Register or log in to add new notes.