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

Support lambda-based default values for params #510

Merged
merged 1 commit into from
Nov 20, 2013
Merged

Support lambda-based default values for params #510

merged 1 commit into from
Nov 20, 2013

Conversation

myitcv
Copy link
Contributor

@myitcv myitcv commented Nov 19, 2013

The test gives an example of what we're looking for here:

params do
  optional :random, default: -> { Random.rand }
  optional :not_random, default: Random.rand
end
get '/numbers' do
  { random_number: params[:random], non_random_number: params[:non_random_number] }
end

@dblock
Copy link
Member

dblock commented Nov 19, 2013

Very nice. Could you please update CHANGELOG and README, please via git commit --amend. Thanks!

@myitcv
Copy link
Contributor Author

myitcv commented Nov 19, 2013

Sure will. Clearly being a bit slow here... but post --amend how do I re-push without deleting and recreating the branch?

@dblock
Copy link
Member

dblock commented Nov 19, 2013

You force-push it, git push origin branch -f.

@myitcv
Copy link
Contributor Author

myitcv commented Nov 19, 2013

:-( I feared as much.

Ok, that should be done now.

@dblock
Copy link
Member

dblock commented Nov 19, 2013

Check travis, you have offended the Rubocops :)

@@ -12,6 +12,8 @@ Next Release
* [#500](https://github.com/intridea/grape/pull/500): Skip entity auto-detection when explicitely passed - [@yaneq](https://github.com/yaneq).
* Your contribution here.

#### Features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put Features above, and move * Your contributions here. into it, please.

@dblock
Copy link
Member

dblock commented Nov 19, 2013

README still needs the documentation that this construct supports lambdas.

@myitcv
Copy link
Contributor Author

myitcv commented Nov 19, 2013

Sorry, sloppy work on the README and CHANGELOG updates - thanks for the catches. They are now committed, as are the Rubocop fix and an update to .rubocop.yml to ignore binstubs created bin dir.

@myitcv
Copy link
Contributor Author

myitcv commented Nov 19, 2013

@dblock - is this now good to be pulled?

Let me know if there is anything else outstanding.

Much appreciated.

dblock added a commit that referenced this pull request Nov 20, 2013
Support lambda-based default values for params
@dblock dblock merged commit 5a7aa6f into ruby-grape:master Nov 20, 2013
@dblock
Copy link
Member

dblock commented Nov 20, 2013

Merged, good work.

@myitcv myitcv deleted the lambda_based_default_params branch November 21, 2013 10:24
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.

2 participants