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

Do not modify a Hash argument to error! #1336

Merged
merged 1 commit into from
Mar 25, 2016

Conversation

tjwp
Copy link
Contributor

@tjwp tjwp commented Mar 23, 2016

This change allows an immutable hash, for example a frozen constant, to be passed as the message to error!.

If a :with value needs to removed from the specified message then a new hash is created without that key.

@tjwp tjwp changed the title Do not modify a Hash argument to error\! Do not modify a Hash argument to error! Mar 24, 2016
@@ -12,6 +12,7 @@
* [#1325](https://github.com/ruby-grape/grape/pull/1325): Params: Fix coerce_with helper with Array types - [@ngonzalez](https://github.com/ngonzalez).
* [#1326](https://github.com/ruby-grape/grape/pull/1326): Fix wrong behavior for OPTIONS and HEAD requests with catch-all - [@ekampp](https://github.com/ekampp), [@namusyaka](https://github.com/namusyaka).
* [#1330](https://github.com/ruby-grape/grape/pull/1330): Add `register` keyword for adding customized parsers and formatters - [@namusyaka](https://github.com/namusyaka).
* [#1336](https://github.com/ruby-grape/grape/pull/1336): Do not modify Hash argument to `error!` - [@tjwp](https://github.com/tjwp)
Copy link
Member

Choose a reason for hiding this comment

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

Add a period to the end.

@dblock
Copy link
Member

dblock commented Mar 25, 2016

This makes sense. See comments and please also squash your commits.

This change allows an immutable hash, for example a frozen constant, to be passed as the message to `error!`.

If the message is a Hash, then it is always duplicated, and any `:with` key is removed from the copy.
@tjwp
Copy link
Contributor Author

tjwp commented Mar 25, 2016

Updated to use dup and commits squashed.

@dblock dblock merged commit 7c98ebb into ruby-grape:master Mar 25, 2016
@dblock
Copy link
Member

dblock commented Mar 25, 2016

👍 merged

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