intridea/grape — pull request #269 by simulacre (2012-11-01 02:15:16+00:00)
Title: Explicit return calls do not raise LocalJumpError

Instead of calling instance_eval on the block passed into
``Endpoint#initialize``, create an anonymous UnboundMethod with the block as
the method body. When executing the block bind the instance of Endpoint
to the UnboundMethod and call it.

This behavior and solution is taken from Sinatra.

This solution also makes it possible to pass the values of
``Endpoint#params`` as arguments to the block. That feature is not present
in this commit, but is trivial to implement.