liufengyun / hashdiff

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

Change HashDiff Constant to Hashdiff #65

Closed jfelchner closed 5 years ago

jfelchner commented 5 years ago

Why This Change Is Necessary

The name of this gem is hashdiff. There is another gem named hash_diff. When they are both required via dependencies, errors are thrown. Additionally since the behavior is different, gems that are relying on hashdiff's behavior, may get hash_diff's behavior and vice versa.

The reason for the conflict is because, based on ruby conventions, _'s are the separators for camel case.

So:

'hashdiff'.camelize # => "Hashdiff"

'hash_diff'.camelize # => "HashDiff"

Unfortunately instead of making the base module of this gem Hashdiff, it's called HashDiff and it conflicts.

How These Changes Address the Issue

We change all of the constants to the new constant, including in documentation and tests.

Then we add a shim to allow the old constant to be used and therefore maintain backward compatibility.

Finally we add a warning message for users of the gem that the old constant will be removed in the next major version bump.

Side Effects Caused By This Change

A new warning is added when loading the gem.


References:

jfelchner commented 5 years ago

Test failures seem to be Rubocop issues that existed before this PR.

liufengyun commented 5 years ago

Thanks a lot @jfelchner . WDYT @krzysiek1507 ?

jfelchner commented 5 years ago

@liufengyun just remember this needs to be version 0.4.0.

liufengyun commented 5 years ago

Thank a lot @jfelchner 🎉

And thanks for reviewing @krzysiek1507 @luke-hill !

bquorning commented 4 years ago

@liufengyun Could you please update the GitHub repository description as well?

image

liufengyun commented 4 years ago

@bquorning It's changed now, thanks for the catch.