Here is, for example, a standard if semantic:
if (condition)
do stuff
end
What I want to be able to do is to re-write if in such a way that, if an exception is thrown, I can do some error handling.
Does ruby have a way to re-define pre-existing syntax? If so, how?
EDIT:
Lets say in an if condition, a method is called on nil in the condition if(my_object.my_method). If my_object isn’t defined, ruby would throw an error. I’d like to be able to change the way if behaves such that it can catch errors. (In my specific situation, it would email me the stack trace… but emailing is the easy part).
I don’t think there’s need to redefine the ruby behavior.
For sure your application has kinda main method, so you can wrapp it with exception handling.