Created
August 5, 2009 04:33
-
-
Save ashrewdmint/162504 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# There are some faster ones out there, but I thought this was cute: | |
class Array | |
def duplicates | |
self.reject {|item| self.select {|sibling| sibling == item}.length == 1}.uniq | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment