Skip to content
instance method

Set#replace

(::_Each[A]) -> self
replace(enum) → self

Replaces the contents of the set with the contents of the given enumerable object and returns self.

Example
set = Set[1, 'c', :s]             #=> Set[1, "c", :s]
set.replace([1, 2])               #=> Set[1, 2]
set                               #=> Set[1, 2]
See also #reject! #reset #proper_superset? #select! also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0