Basic
Initializing a Set
:
rbmyset = Set.new
myset.add(value)
Create a Set
from an Array
:
Operators
Operator | Description |
---|
+ | Union |
- | Difference |
& | Intersection |
^ | Symmetric difference |
Methods
Method | Description |
---|
to_a | Set → Array |
size | Number of elements. |
empty? | true if there are no elements. |