We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require 'hashdiff' Hashdiff::VERSION #=> "1.1.0"
The following snippet fails to ignore top level key :a
:a
a = { a: 4, b: {a: 5, c: 6} } b = { b: {a: 7, c: 3} } diff = Hashdiff.diff(a, b, ignore_keys: :a) #=> [["-", "a", 4], ["~", "b.c", 6, 3]]
Shouldn't diff be expected to be the below?
diff
[["~", "b.c", 6, 3]]
The documentation on ignore_keys states that:
ignore_keys
The :ignore_keys option allows you to specify one or more keys to ignore, which defaults to [] (none). Ignored keys are ignored at all levels.
:ignore_keys
[]
Here line where :ignore_keys happens (in Hashdiff::ComparableHashes::call):
Hashdiff::ComparableHashes::call
opts[:ignore_keys].each { |k| common_keys.delete k }
added_keys and deleted_keys don't seem to have the exclusion applied.
added_keys
deleted_keys
The text was updated successfully, but these errors were encountered:
a = { a: 4, b: {a: 5, c: 6} } b = { b: {a: 7, c: 3}, d: 8 }
(1) ignore_keys: keep backwards compatibility
diff = Hashdiff.diff(a, b, ignore_keys: [:a, :d]) #=> [["-", "a", 4], ["~", "b.a", 5, 7], ["~", "b.c", 6, 3], ["+", "d", 8]]
b.a
:d
(2) new ignore_added_keys: only affects added keys
ignore_added_keys
diff = Hashdiff.diff(a, b, ignore_keys: [:a, :d]) #=> [["-", "a", 4], ["~", "b.a", 5, 7], ["~", "b.c", 6, 3]]
Sorry, something went wrong.
No branches or pull requests
The following snippet fails to ignore top level key
:a
Shouldn't
diff
be expected to be the below?The documentation on
ignore_keys
states that:Here line where
:ignore_keys
happens (inHashdiff::ComparableHashes::call
):added_keys
anddeleted_keys
don't seem to have the exclusion applied.The text was updated successfully, but these errors were encountered: