instance method
Set#include?
(A) -> bool
include?(item) → true or false
set.c
View on GitHub ↗
static VALUE
set_i_include(VALUE set, VALUE item)
{
return RBOOL(RSET_IS_MEMBER(set, item));
}
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?