Skip to content

Instantly share code, notes, and snippets.

@pcorliss
Created December 9, 2021 03:27
Show Gist options
  • Save pcorliss/43ca000dc7be17e06c0bce870816ac86 to your computer and use it in GitHub Desktop.
Save pcorliss/43ca000dc7be17e06c0bce870816ac86 to your computer and use it in GitHub Desktop.
irb(main):035:0> s = Set.new
=> #<Set: {}>
irb(main):036:0> a = Set.new([1,2,3])
=> #<Set: {1, 2, 3}>
irb(main):037:0> b = Set.new([1,2,3])
=> #<Set: {1, 2, 3}>
irb(main):038:0> s.add(a)
=> #<Set: {#<Set: {1, 2, 3}>}>
irb(main):039:0> s.include?(b)
=> true
irb(main):040:0> a.add 99
=> #<Set: {1, 2, 3, 99}>
irb(main):041:0> s.include?(b)
=> false
irb(main):042:0> s.include?(a)
=> false
irb(main):043:0> s.add a
=> #<Set: {#<Set: {1, 2, 3, 99}>, #<Set: {1, 2, 3, 99}>}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment