Created
March 19, 2012 12:53
-
-
Save rkh/2110987 to your computer and use it in GitHub Desktop.
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 lazy | |
yield | |
rescue NameError | |
Module.new | |
end | |
begin | |
raise "foo" | |
rescue lazy { Foo }, lazy { Exception } | |
end |
Yeah, or that. Performance optimizing your rescue
clause.
I don't always rescue exceptions, but when I do it's SUPER FAST.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or use a null object: