Skip to content
instance method

Set#clear

() -> self
clear → self

Removes all elements and returns self.

Example
set = Set[1, 'c', :s]             #=> Set[1, "c", :s]
set.clear                         #=> Set[]
set                               #=> Set[]
See also #classify #collect! #as_json #compare_by_identity also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0