Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Allows TimeUuid and Uuid to be compared for equality #111

Closed
wants to merge 1 commit into from

Conversation

jasonmk
Copy link
Contributor

@jasonmk jasonmk commented Jun 20, 2014

Currently, if you try to compare a Uuid and TimeUuid, there's some weirdness because of how Comparable implements ==.

[2] pry(main)> id = Cql::TimeUuid::Generator.new.next
=> #<Cql::TimeUuid:0x00000001d6fe88 @n=198073153519907614003849507369077940458>
[3] pry(main)> id2 = Cql::Uuid.new(id.value)
=> #<Cql::Uuid:0x00000001d9df40 @n=198073153519907614003849507369077940458>
[4] pry(main)> id2 == id
=> true
[5] pry(main)> id == id2
=> false

This patch reverses the order of operations allowing a Uuid and TimeUuid with the same value to be equal.

@iconara
Copy link
Owner

iconara commented Jun 21, 2014

Good catch. I've merged it (minus some unrelated whitespace changes) and it will be released with the next patch release.

@iconara iconara closed this Jun 21, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants