This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: return_bang 1.0
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 from methods. 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?
Features
Implements non-local exits for methods
Nestable
Named and stack-based exit points, go exactly where you need to be
Ignores pesky ensure blocks for when you really, really need to return
Synopsis
require'return_bang/everywhere'defsome_methoddeeply_nested# never reachedenddefdeeply_nestedreturn!endreturn_heredosome_methodend# resumes here
Testimonials
“you’ll wind up with your cock in /dev/null somehow” – slyphon
“Haha! Right! This skips ensure… SO EVIL‼‼” – drbrain
“This is so evil that 6 def test_… have turned into: 16 tests, 65
assertions, 18 failures, 7 errors” – drbrain