diff-lcs icon indicating copy to clipboard operation
diff-lcs copied to clipboard

Add documentation how to override object equality

Open coezbek opened this issue 4 years ago • 1 comments

It is unclear to me if (at all) and how to define what constitutes equality for diff-lcs. I tried overriding == operator but this did not work.

Looking into the code it seems Hash equality needs to be implemented (i.e. eql? and hash).

https://github.com/halostatue/diff-lcs/blob/e4b02743f4f2d40cd43b0ec9071d6a5ba9787336/lib/diff/lcs/internals.rb#L294

Would it make sense to document this?

coezbek avatar Jun 06 '21 18:06 coezbek

It would be. I’d suggest that it might be worth adding some tests to verify this.

halostatue avatar Jun 08 '21 01:06 halostatue