Closed jasonmk closed 10 years ago
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.
Good catch. I've merged it (minus some unrelated whitespace changes) and it will be released with the next patch release.
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.