a^b is the set of values that appear in one set but not both: (a|b)-(a&b)
require 'set' primes = Set[2, 3, 5, 7] odds = Set[1, 3, 5, 7, 9] primes ^ odds # => #<Set: {1, 2, 9}>