-
-
Notifications
You must be signed in to change notification settings - Fork 102
Call #to_s on output to avoid leaking Differ's implementation details. #69
Call #to_s on output to avoid leaking Differ's implementation details. #69
Conversation
@phiggins I can see why this would be useful. @myronmarston @xaviershay @JonRowe got any objections? @phiggins did this directly cause a bug? If not we'll almost certainly not be merging this until after 3.0 gets released. Thanks for the PR! 😄 |
I agree we shouldn't leak this but I'd prefer we did the |
@samphippen No, I just noticed it when working on adding diff support to rspec-mocks and debugging output. |
@JonRowe I'm not sure I understand your reasoning. It seems bad to me that |
@JonRowe I definitely think it's better not to leak the EncodedString out of differ space. Otherwise other people have to be aware that EncodedString exists, as opposed to this object. |
I like this change, and agree with @phiggins that it seems preferable to always return a string. |
@phiggins say we decided we wanted to state the encoding types in the output, the ideal place to pass this information about would be with this class, we could decide this is a public api and pass it back to formatters for similar reasons, so for now if we are going to truncate this down into a string I'd rather it was done at the endpoint and not here |
If we want to make |
I agree with @myronmarston and @phiggins |
…details Call #to_s on output to avoid leaking Differ's implementation details.
Merged. Thanks, @phiggins. |
Prior to this, the output of
Differ.diff
was an EncodedString if the arguments were diffable. An EncodedString mostly acts like a String, but nothing outside of Differ needs to know it exists.