instance method
Set#|
(::_Each[A]) -> self
set | enum → new_set
set.c
View on GitHub ↗
static VALUE
set_i_union(VALUE set, VALUE other)
{
set = rb_obj_dup(set);
set_merge_enum_into(set, other);
return set;
}
Returns a new set built by merging the set and the elements of the given enumerable object.
Example
Set[1, 2, 3] | Set[2, 4, 5] #=> Set[1, 2, 3, 4, 5] Set[1, 5, 'z'] | (1..6) #=> Set[1, 5, "z", 2, 3, 4, 6]