Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit return calls do not raise LocalJumpError #269

Merged
merged 3 commits into from
Nov 1, 2012

Conversation

gruis
Copy link
Contributor

@gruis gruis commented Nov 1, 2012

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.

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.
@dblock
Copy link
Member

dblock commented Nov 1, 2012

dblock added a commit that referenced this pull request Nov 1, 2012
Explicit return calls do not raise LocalJumpError
@dblock dblock merged commit d85c2b3 into ruby-grape:master Nov 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants