Return_bang 1.0 Released

return_bang version 1.0 has been released!

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’

def some_method
deeply_nested
# never reached
end

def deeply_nested
return!
end

return_here do
some_method
end

resumes here

== Install

sudo gem install return_bang

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21.12.2011 01:53, Eric H. wrote:

sudo gem install return_bang

Where is this different from the builtin catch/throw mechanism?

=========================================
def some_method
deeply_nested

never reached

end

def deeply_nested
throw :foo
end

catch(:foo) do
some_method
end

resumes here

=========================================

Vale,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO8hqpAAoJELh1XLHFkqhaON4IAJEYVUzd9z/Xtig51KFtRtn3
I/HuBEIK2wXTtJgzCE6UWjxFc4PSRluClyNYl9WCNFVYS+VRIoz4xhqrVxHYcTyl
wDXobkagZEF2NvHi31hVL7fTlh2oJwhwc94IouFvDK1uuIs8WSg9lRQj89oIm/NK
zJXIaLg/kGNMn23Q1N0k4VnpRwgJsehewHGtIeLCIRiRaM5/FzES3XpX5eyiF3Kz
IHoqb5FBIMYEe9kjXeVxv57Rl1n95LoGv6bGKCwQV0qog466uNA9hRK6qoHERqfr
15hNoKL21cYOAKb6ZxYHApsoRJKjDPyvA5pFGiVwLUOr3OQFg6bZ3TvKPyYM3nc=
=g5r4
-----END PGP SIGNATURE-----

Marvin Gülker wrote in post #1037733:

On 21.12.2011 01:53, Eric H. wrote:

sudo gem install return_bang

Where is this different from the builtin catch/throw mechanism?

It skips all ensure clauses in the call stack; throw() does not.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21.12.2011 20:54, Suraj K. wrote:

Marvin Gülker wrote in post #1037733:

On 21.12.2011 01:53, Eric H. wrote:

sudo gem install return_bang

Where is this different from the builtin catch/throw mechanism?

It skips all ensure clauses in the call stack; throw() does not.

Ah, I see. Thank you.

Vale,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO8kGsAAoJELh1XLHFkqhaDrkH/Aw01qCs9NxpJ0FZI3wBXGix
TS/gNoBy5YRF+sGvOCcV5RhGhH1q6jv4+XEIdzbK6BRIDIGaQxkbKw1FtnAbtBUv
s2WijFqI0d3Ty6+thAqX17JhBvpwqkRLW610JVxvYbJJsCgEA9uG51Yh0P8hc312
imBBY2NcASdke4CusZk+FpZUShe6i4X+bZ9vObvxDEUB5/egQSTTHUrMtiQjP8Jc
BioOyNJp2J0nl30OJ+I/VrE0xfvVjXfcLdzQ9PfMFIKqSeTg7H6jwGm8i3ut2GUi
voaSSL9KK4cfqs096tVP6+zwOg5GZkVfmltmA7qphSeL72JybDIuilcnANN3thI=
=rG19
-----END PGP SIGNATURE-----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs