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 delegate to Kernel methods. #217

Conversation

maltoe
Copy link

@maltoe maltoe commented Apr 25, 2016

This patch prevents Entity from delegating attributes
to Kernel methods. This is accomplished by testing the
methods the Entity class responds to for ownership
by the Entity class itself.

Fixes #215.

This patch prevents Entity from delegating attributes
to Kernel methods. This is accomplished by testing the
methods the Entity class responds to for ownership
by the Entity class itself.

Fixes ruby-grape#215.
@maltoe
Copy link
Author

maltoe commented Apr 25, 2016

The build error seems unrelated ("listen" gem doesn't work with Ruby < 2.2).

@dblock
Copy link
Member

dblock commented Apr 25, 2016

This needs a CHANGELOG entry too, please. Try fixing the build too, please, maybe we just need to lock listen or whatever brings it down to a version.

@maltoe
Copy link
Author

maltoe commented Apr 25, 2016

There you go. Removed pry from the test suite, too, as imho it doesn't belong there. When you need it to debug, require it manually.

@@ -1,7 +1,7 @@
0.5.2 (Next)
============

* Your contribution here.
Copy link
Member

Choose a reason for hiding this comment

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

Put this back below your change entry please.

@dblock
Copy link
Member

dblock commented Apr 25, 2016

Btw, https://github.com/ruby-grape/grape is failing the same way, if you feel generous today and want to fix :)

@maltoe maltoe force-pushed the fix_215_dont_delegate_to_kernel_methods branch from 755a089 to e7312df Compare April 25, 2016 14:47
@maltoe
Copy link
Author

maltoe commented Apr 25, 2016

I've put the "Your contrib here" statement back in. Sorry, can't spend any more time on this today for grape, maybe some other time.

@@ -1,6 +1,7 @@
0.5.2 (Next)
============

* [#215](https://github.com/ruby-grape/grape-entity/pull/217): `#delegate_attribute` should not delegate to methods included with `Kernel`.
Copy link
Member

Choose a reason for hiding this comment

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

One last nitpick and then I stop. See the format of these below, your name should be at the end, so - [@...]().. Thanks.

@maltoe maltoe force-pushed the fix_215_dont_delegate_to_kernel_methods branch from e7312df to bda6d66 Compare April 26, 2016 13:14
@maltoe
Copy link
Author

maltoe commented Apr 26, 2016

No big deal, keep the code quality up 😄

@dblock dblock merged commit e362c71 into ruby-grape:master Apr 26, 2016
@dblock
Copy link
Member

dblock commented Apr 26, 2016

I merged. And still am amending the CHANGELOG a bit since the period is in the wrong place :)

@dblock
Copy link
Member

dblock commented Apr 26, 2016

Thanks for contributing this! It was a major PITA.

@maltoe
Copy link
Author

maltoe commented Apr 27, 2016

You seem to have a bit too much time :) But thanks for merging! looking forward to getting rid of our monkey-patch.

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