-
Notifications
You must be signed in to change notification settings - Fork 901
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
PaperTrail.request { } should return the value of the block to aid in passive wrapping #1074
Conversation
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.
Hi Kurtis. Looks good. Please:
- Document the return type in the method documentation
- Add a test
- Add an entry to the changelog under Unreleased -> Added
@jaredbeck The whole point of this PR is that the return type could be anything. |
CHANGELOG.md
Outdated
ApplicationError | ||
end | ||
# => ApplicationError has been raised! | ||
``` |
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.
As I said, please put this under "Added". I don't see it as a breaking change.
Also, please omit the code example. The single sentence description is sufficient.
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.
We're changing the return type of a public method from always nil to sometimes nil, are you sure that's not a breaking change?
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.
We're changing the return type of a public method from always nil to sometimes nil, are you sure that's not a breaking change?
Yes, you're right (both correct and righteous) to question this 😁 I don't consider it a breaking change, because I don't think anyone is depending on the fact that it is returning nil. What do you think? Do you think people will be depending on the nil?
To clarify, I'd like the method documentation to say something like "If a block is given, returns value from block" |
Roger. |
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.
Still needs requested change to method documentation
@@ -7,7 +7,7 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). | |||
|
|||
### Breaking Changes | |||
|
|||
- None | |||
- `PaperTrail.request do ... end` now returns whatever value is returned from the given block. |
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.
This is still listed under "Breaking Changes" and I still think it should be under "Added" for the reasons I have already given. I'm open to arguments either way, but I haven't heard any convincing arguments for it being a breaking change yet.
Closing via #1077, preserving your authorship. Thanks Kurtis. |
So I just spent the last 3 hours debugging because (ultimately) I had overwritten a method that some library depended on and I assumed that the below would be passively wrapping:
Turns out it doesn't, because it's forced to return nil.