Skip to content

Instantly share code, notes, and snippets.

@sneakin
Created December 23, 2010 03:32
Show Gist options
  • Save sneakin/752519 to your computer and use it in GitHub Desktop.
Save sneakin/752519 to your computer and use it in GitHub Desktop.
Example where an ensure clause will prevent exceptions from being raised.
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