a-b: is the elements of a except for those also in b
require 'set'
primes = Set[2, 3, 5, 7]
odds = Set[1, 3, 5, 7, 9]
p primes-odds # => #<Set: {2}>
p odds-primes # => #<Set: {1, 9}>
p primes.difference(odds) # A named method alias
Related examples in the same category