liufengyun / hashdiff

Hashdiff is a ruby library to to compute the smallest difference between two hashes
MIT License
559 stars 63 forks source link

Compare objects inheriting from the same class #54

Closed krzysiek1507 closed 5 years ago

krzysiek1507 commented 5 years ago
BetterHash = Class.new Hash
EvenBetterHash = Class.new Hash

HashDiff.diff(BetterHash.new, EvenBetterHash.new)
=> [["~", "", {}, {}]]

HashDiff.diff({}, BetterHash.new)
=> []

HashDiff.diff(BetterHash.new, {})
=> [["~", "", {}, {}]]

I wonder when we can compare two objects. When they inherit from the same class or they have to be instances of the same class?

liufengyun commented 5 years ago

Maybe it should always return []?