soveran/micromachine — pull request #4 by Burgestrand (2012-04-16 20:47:33+00:00)
Title: Use Hash#fetch to raise InvalidEvent on missing event

Hello again!

I noticed `#trigger?` rescues NoMethodError and then raises an InvalidEvent error if an event has not been defined. I changed it to use Hash#fetch with a block instead. The block is invoked when the key is missing, and from there we raise.

The semantics are the same, but we avoid raising an unnecessary error (and output of `ruby -d` when using micromachine will be a little nicer as well).