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

Add documentation for attributes_for_super_diff #170

Open
mcmire opened this issue Jan 2, 2023 · 1 comment
Open

Add documentation for attributes_for_super_diff #170

mcmire opened this issue Jan 2, 2023 · 1 comment

Comments

@mcmire
Copy link
Collaborator

mcmire commented Jan 2, 2023

By default, when SuperDiff is constructing a diff for two instances of the same PORO, it will list each instance variable in the class along with its value. As SuperDiff inspects values recursively, in certain cases this diff may unhelpfully produce a lot of output. To mitigate this, you can give your PORO class an attributes_for_super_diff method. SuperDiff will then use this method to list key/value pairs instead.

This fact is buried in the gem. In the absence of extensive documentation we should probably mention it the README, under the Configuration section. It might also be good to recommend implementing ==, since if you're implementing attributes_for_super_diff you probably also want to implement ==.

@jas14
Copy link
Collaborator

jas14 commented Sep 14, 2024

I think this has been resolved by #225, specifically https://github.com/splitwise/super_diff/pull/225/files#diff-42748c8eb0945ca999ed767e3bc9481068e029207049709f7b8dfd9f75fbf537R143. There's no mention of also overriding ==. Presumably the latter is needed in cases where matching fails on some attribute not indicated by attributes_for_super_diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants