liufengyun / hashdiff

Hashdiff is a ruby library to to compute the smallest difference between two hashes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compare objects inheriting from the same class

krzysiek1507 opened this issue · comments

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?

Maybe it should always return []?