Since you are looking for advice after all, I'll answer your questions directly to the best of my ability.

Quote:

why did I snap?




You're human, when someone does something we don't like, we get angry. Learning how to deal with anger is important, I'm glad you snapped out of it before you did anything worse than you did. You should try talking to people about what is making you angry, communication makes things better and also can provide you with solutions when you're confused.

Quote:

Was I in the right?




Right and wrong are ambiguous at best, this is something you'll have to figure out for yourself based on your principles and morals. Whether you were within your school rules and the law are far easier to discover. He was harassing you and did start poking you with a ruler. Now, technically that could be taken as assault in many countries right there. I personally think what you did was justified. One question, how many times did you express your discomfort to him and how many times did you ask him to stop?

Quote:

Any insights?




Nothing else to add really.

Quote:

My friends are too biased for me to ask.




Your friends might provide you better answers because they know you better than we do.
_________________________
Self Defense
(Website by Marc MacYoung, not me)