Hello,
The override of the ==/equal? methods seem to be used when checking values of an Hash, but not when checking the keys. Here is an example with a simple class :
class Color
attr_reader :value
def initialize(value)
@value = value
end
def equal?(other)
return false unless other.is_a?(Color)
@value == other.value
end
def ==(other)
return false unless other.is_a?(Color)
@value == other.value
end
end
Hello, The override of the ==/equal? methods seem to be used when checking values of an Hash, but not when checking the keys. Here is an example with a simple class :
Hashdiff.best_diff({1 => Color.new('red')}, {1 => Color.new('red')})
returns[]
as expected butHashdiff.best_diff({Color.new('red') => 1}, {Color.new('red') => 1})
returns[["~", "#<Color:0x000014ac0e49d418>", 1, nil]]
Thanks!