This repository was archived by the owner on Jun 13, 2018. It is now read-only.
Add equality operator to ShipmentEvent and TrackingResponse#372
Merged
Add equality operator to ShipmentEvent and TrackingResponse#372
Conversation
518b209 to
3fdd841
Compare
|
|
||
| def ==(other) | ||
| name == other.name && time == other.time && location == other.location && message == other.message && | ||
| type_code == other.type_code |
Contributor
There was a problem hiding this comment.
Given the number of things you're comparing, I'd prefer it if we separated them by lines, i.e.
name == other.name &&
time == other.time &&
location == other.location &&
...Alternatively, you could iterate over all of them, like:
attributes = [:name, :time, :location, :message, :type_code]
attributes.all? { |attr| self.public_send(:attr) == other.public_send(:attr) }
Contributor
Author
|
Changed how distinct |
| end | ||
|
|
||
| def ==(other) | ||
| attributes = %i(name time location message type_code) |
Contributor
|
🔴 tests aren't your fault, remote APIs are being flaky. Merge when 💚 eventually. |
added 5 commits
May 18, 2016 10:44
…t equality, refactored how attributes are compared for equality
36822a4 to
7502694
Compare
Contributor
|
LGTM 🚀 |
maartenvg
pushed a commit
that referenced
this pull request
Oct 8, 2017
added equality operator to ShipmentEvent and TrackingResponse
maartenvg
pushed a commit
that referenced
this pull request
Oct 12, 2017
added equality operator to ShipmentEvent and TrackingResponse
maartenvg
pushed a commit
that referenced
this pull request
Nov 9, 2017
added equality operator to ShipmentEvent and TrackingResponse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Useful for writing tests to compare
ShipmentEventandTrackingResponseobjects and future use cases.cc: @jonathankwok @MalazAlamir