Created
September 10, 2012 23:37
-
-
Save mcgain/3694817 to your computer and use it in GitHub Desktop.
terse exception creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def new_exception(exception_name) | |
| klass = Class.new Exception | |
| Object.const_set exception_name.to_s, klass | |
| end | |
| new_exception "CannotFindPants" | |
| new_exception :FlobbetsAreFlumoxed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment