Skip to content

Instantly share code, notes, and snippets.

@blaix
Created May 6, 2009 18:58
Show Gist options
  • Save blaix/107671 to your computer and use it in GitHub Desktop.
Save blaix/107671 to your computer and use it in GitHub Desktop.
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