halostatue / diff-lcs

Generate difference sets between Ruby sequences.
http://halostatue.github.com/diff-lcs
Other
290 stars 57 forks source link

update Change and ContextChange's '==' methods to compare against the other object's class #29

Closed kevinmook closed 10 years ago

kevinmook commented 10 years ago

This pull request updates the "==" methods in Diff::LCS::Change and Diff::LCS::ContextChange to verify the other object is of the same class.

This is probably a good practice whenever redefining ==, but I specifically needed to do this for compatibility with awesome_print. For for some reason, when printing out an object, awesome_print tries to compare the result against an object of a different type. awesome_print probably shouldn't do that, but this seemed like a good improvement anyway.

I didn't make any new tests as this seemed like a minor improvement, but I would be happy to add some if you would like.