hash = {} 
hash["key"] += 1 
 
generates: undefined method `+' for nil (NameError) 
as it should.

However, if I wanted to globally override the NameError
exception handling to do something like:

if the object is a hash element and nil, and method is +=,
make it a number, set it to 0 and redo the operation, otherwise
do the normal NameError procedure.

How could it be done?

I'm sure the above could be done by overriding Hash []= but
then you may have a lot of overhead that you could avoid
by implementing it in an exception.

thanks,
-joe