Commit 3cccf89
committed
♻️ Match subclasses in
Copying the behavior of `Array#eql?` and `Array#hash`, this updates both
`SearchResult#eql?` and `SearchResult#hash` to match explicitly on
`SearchResult` rather than the specific `self.class`. This way, they
also match subclass instances (assuming the subclass doesn't override
these methods).
`#hash` was also re-ordered to match `#eql?`. This isn't needed for
performance. It just makes it a little bit easier to identify that the
two methods are comparing the same properties.SearchResult#eql?/#hash
1 parent 803efb1 commit 3cccf89
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
96 | 112 | | |
97 | 113 | | |
98 | 114 | | |
| |||
0 commit comments