stdlib : set
A set is an unordered list of unique elements. Set squishes in enumerable, so you can use any of the enumerable methods on it as well.
«
set « element
Adds an element to the set if it is not already in the set. Returns the set.
add
set.add element
Same as «.
clear
set.clear
Removes all elements from the set. Returns the set.
delete
set.delete element
Deletes an element from the set. Returns the set.
each
set.each { item block }
Passes in each item into the block. Order is arbitrary.
empty?
set.empty?
Checks if the set is empty.
length
set.length
Returns how many items are in the set.
merge
set.merge enum
Adds items from enum to the set.
new
set.new
set.new array
set.new …
Creates a new set. If given an array or a list of elements, the set will be initialized with those elements.
to_array
set.to_array
Returns an array of the elements in the set, in no particular order.