Created
May 6, 2009 18:58
-
-
Save blaix/107671 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
class Array | |
# True if elements in +array+ are the same as the elements in +self+, | |
# but not necessarily in the same order. | |
def equals?(array) | |
array - self == self - array | |
end | |
end | |
# [1, 2, 3].equals? [3, 2, 1] => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment