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

Override StripeObject#eql? and #hash to produce more optimistic equivalency #688

Merged
merged 1 commit into from
Sep 14, 2018

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Sep 13, 2018

Overrides #eql? (hash equality) and #hash so that Stripe objects can
be used more easily as Hash keys and that certain other frameworks that
rely on these methods will have an easier time (e.g. RSpec's change,
see #687).

I think this might be a little controversial if we weren't already
overriding the #== implementation, but because we are, I think it
makes sense to extend it to these two methods as well.

Fixes #687.

r? @ob-stripe

…quivalency

Overrides `#eql?` (hash equality) and `#hash` so that Stripe objects can
be used more easily as Hash keys and that certain other frameworks that
rely on these methods will have an easier time (e.g. RSpec's `change`,
see #687).

I think this might be a little controversial if we weren't already
overriding the `#==` implementation, but because we are, I think it
makes sense to extent it to these two methods as well.
Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

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

Nice! LGTM.

@ob-stripe ob-stripe merged commit 8a53098 into master Sep 14, 2018
@ob-stripe ob-stripe deleted the brandur-hash branch September 14, 2018 08:10
@ob-stripe
Copy link
Contributor

Released as 3.26.1.

@brandur-stripe
Copy link
Contributor

Thanks OB!

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

Successfully merging this pull request may close these issues.

4 participants