Skip to content

Instantly share code, notes, and snippets.

@ghiculescu
Last active October 6, 2015 10:39
Show Gist options
  • Save ghiculescu/237838aff13e7e593666 to your computer and use it in GitHub Desktop.
Save ghiculescu/237838aff13e7e593666 to your computer and use it in GitHub Desktop.
my_set = JillSet.new
my_set.insert("alex") # returns true
my_set.insert("jill") # returns true
my_set.has?("jill") # returns true
my_set.has?("Jill") # returns false
my_set.items # returns ["alex", "jill"]
my_set.insert("jill") # returns false
my_set.has?("jill") # returns true
my_set.remove("jill") # returns true
my_set.remove("jill") # returns false
my_set.items # returns ["alex"]
my_set.empty? # returns false
my_set.clear! # returns nil (doesn't explicitly return anything)
my_set.empty? # returns true
my_set.items # returns []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment