Skip to content

Instantly share code, notes, and snippets.

@catwell
Created November 3, 2010 11:11
Show Gist options
  • Save catwell/660976 to your computer and use it in GitHub Desktop.
Save catwell/660976 to your computer and use it in GitHub Desktop.
In Ruby ensure blocks are *not* executed when an exception is rescued
a = 0
begin
a += 1
raise if a < 3
rescue
puts "rescued"
retry
ensure
puts "ensured"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment