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

Implement uniqueness (hash equality) #129

Merged
merged 4 commits into from
Feb 5, 2019
Merged

Implement uniqueness (hash equality) #129

merged 4 commits into from
Feb 5, 2019

Conversation

jage
Copy link
Contributor

@jage jage commented Feb 1, 2019

Will reduce duplicates when using .uniq, to get even better result the user could first normalize, then uniq.

Close #123

Will reduce duplicates when using `.uniq`, to get even better result the
user could first normalize, then uniq.

Close #123
lib/twingly/url.rb Outdated Show resolved Hide resolved
@walro
Copy link
Contributor

walro commented Feb 1, 2019

Couldn't help myself from checking how Ruby does it for the URI class. If I get it correctly they stuff all "components" into an array and piggyback on that array's hash. Feels kind of neat as we'd avoid the usage of digest.

@dentarg
Copy link
Collaborator

dentarg commented Feb 1, 2019

@jage
Copy link
Contributor Author

jage commented Feb 4, 2019

Couldn't help myself from checking how Ruby does it for the URI class. If I get it correctly they stuff all "components" into an array and piggyback on that array's hash. Feels kind of neat as we'd avoid the usage of digest.

👍🏻

I’m thinking we don’t want “implicit cleaning” by using the components, thus. maybe .to_s.hash could be better in this case? Would remove the digest as well.

@walro
Copy link
Contributor

walro commented Feb 4, 2019

I’m thinking we don’t want “implicit cleaning” by using the components, thus. maybe ‘.to_s.hash’ could be better in this case? Would remove the digest as well.

SGTM!

No need to calculate our own, since it is has the same properties as the
string hash.
Copy link
Contributor

@walro walro left a comment

Choose a reason for hiding this comment

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

LGTM

@jage jage changed the title Implement uniqueness Implement uniqueness (hash equality) Feb 5, 2019
@jage
Copy link
Contributor Author

jage commented Feb 5, 2019

So, should we handle this as a strict bugfix, i.e. patch release? I'm thinking this should be released as a patch, the reasoning is that if you write code with [url1, url2].uniq you expect the unique results which didn't work before. If you don't run #uniq nothing will change.

@walro
Copy link
Contributor

walro commented Feb 5, 2019

Sounds reasonable, not sure what other unreleased stuff we have though, so it might be a minor release anyway (or even major) :)

@jage
Copy link
Contributor Author

jage commented Feb 5, 2019

Sounds reasonable, not sure what other unreleased stuff we have though, so it might be a minor release anyway (or even major) :)

Hehe, yup. :)

@jage jage merged commit ecfa92a into master Feb 5, 2019
@jage jage deleted the issue/123/uniqueness branch February 5, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants