Skip to content

Instantly share code, notes, and snippets.

@skateinmars
Created April 24, 2013 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skateinmars/5456363 to your computer and use it in GitHub Desktop.
Save skateinmars/5456363 to your computer and use it in GitHub Desktop.
class String
def new_compare(obj)
send(:'old_=~', Regexp.new(obj))
end
alias_method :'old_=~', :'=~'
alias_method :'=~', :'new_compare'
end
puts ("blah" =~ "blah") == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment