Remove elements from a set
require 'set'
s = (1..3).to_set # => #<Set: {1, 2, 3}>
s.delete 1 # => #<Set: {2, 3}>
s.delete 1 # => #<Set: {2, 3}>: unchanged
s.delete? 1 # => nil: returns nil when no change
s.delete? 2 # => #<Set: {3}>: otherwise returns set
Related examples in the same category