This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: return_bang 1.1
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
return_bang implements non-local exits for methods. As a bonus, you also
get exception handling that ignores standard Ruby’s inflexible begin;
rescue; ensure; end syntax.
Use return_bang to exit back to a processing loop from deeply nested code,
or just to confound your enemies and your friends! What
could possibly go wrong?
1.1 / 2012-04-01
Minor enhancements
Added raise! to raise exceptions
Added rescue! to rescue exceptions raised
Added ensure! to always execute a block of code to perform cleanup