Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created August 8, 2015 15:59
Show Gist options
  • Save Mon-Ouie/5efdab278cbabc3922ac to your computer and use it in GitHub Desktop.
Save Mon-Ouie/5efdab278cbabc3922ac to your computer and use it in GitHub Desktop.
pry(main):1> ab = Set.new(['a', 'b'])
pry(main):1> require 'set'
=> true
pry(main):2> ab = Set.new(['a', 'b'])
=> #<Set: {"a", "b"}>
pry(main):3> c = Set.new(['c'])
=> #<Set: {"c"}>
pry(main):4> abc = Set.new [ab, c]
=> #<Set: {#<Set: {"a", "b"}>, #<Set: {"c"}>}>
pry(main):5> abc.include? c
=> true
pry(main):6> abc > c
=> false
pry(main):9> abc > Set.new([c])
=> true
pry(main):10> abc - Set.new([c])
=> #<Set: {#<Set: {"a", "b"}>}>
pry(main):11> abc - c
=> #<Set: {#<Set: {"a", "b"}>, #<Set: {"c"}>}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment