Skip to content

Instantly share code, notes, and snippets.

@jlhg
Created October 8, 2014 08:47
Show Gist options
  • Save jlhg/1b03843696068f3e559b to your computer and use it in GitHub Desktop.
Save jlhg/1b03843696068f3e559b to your computer and use it in GitHub Desktop.
XOR operation in Ruby
class Array
def ^(that)
self + that - (self & that)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment