-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add possibility to define reusable params. #550
Conversation
@dblock what do you think ? |
(edited) I like the part where you can define I am a bit worried that |
@dm1try Btw, whichever way we go, this is a very elegant approach - you, sir, are a Ruby 師匠 |
@dblock , thanks for feedback! module ApiHelpers
ALLOWED_METHODS = [:params]
def method_missing(name, *args, &block)
ALLOWED_METHODS.include?(name) ? save_lazy_methods : super
end
def api_changed(new_api)
call_lazy_methods
end
end The problem is that we should extend helpers do
params do
end
end
desc 'Get'
params :params do
end And the main problem is that What do the community think? Should we continue?) |
About "serious refactoring", |
Ok, I think I agree with you, Do you think this should be defined as an inner class of Add README and CHANGELOG and I am happy to merge this. |
@dblock hey, thanks for suggestion. I put Can you take a look? |
@@ -14,6 +14,7 @@ Next Release | |||
* [#540](https://github.com/intridea/grape/pull/540): Ruby 2.1.0 is now supported - [@salimane](https://github.com/salimane). | |||
* [#544](https://github.com/intridea/grape/pull/544): The `rescue_from` keyword now handles subclasses of exceptions by default - [@xevix](https://github.com/xevix). | |||
* [#545](https://github.com/intridea/grape/pull/545): Added `type` (Array or Hash) support to `requires`, `optional` and `group` - [@bwalex](https://github.com/bwalex). | |||
* [#550](https://github.com/intridea/grape/pull/550): Added possibility to define reusable params. - [@dm1try](https://github.com/dm1try). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra dot after params
is driving me crazy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch :)
Perfect, merging. |
Add possibility to define reusable params.
Great ❤️ |
Another one concept :)
Examples:
using module: