Created
December 23, 2010 03:32
-
-
Save sneakin/752519 to your computer and use it in GitHub Desktop.
Example where an ensure clause will prevent exceptions from being raised.
This file contains 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 wont_raise | |
raise "Catch me if you can" | |
ensure | |
puts "ensured" | |
return "HA" | |
end | |
def will_raise | |
raise "Caught me" | |
ensure | |
puts "ensured" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment