You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a = {a:'car', b:['truck', 'plane'] }
b = {a:'bus', b:['truck', ' plan'] }
diff = HashDiff.diff(a, b) do |path, obj1, obj2|
case path
when 'b[*]'
true
end
end
=> [["~", "a", "car", "bus"], ["-", "b[1]", "plane"], ["+", "b[1]", " plan"]]
vs.
a = {a:'car', b:['truck', 'plane'] }
b = {a:'bus', b:['truck', ' plan'] }
diff = HashDiff.diff(a, b) do |path, obj1, obj2|
case path
when 'b[*]'
false
end
end
=> [["~", "a", "car", "bus"], ["-", "b[1]", "plane"], ["+", "b[1]", " plan"]]
vs.
a = {a:'car', b:['truck', 'plane'] }
b = {a:'bus', b:['truck', ' plan'] }
diff = HashDiff.diff(a, b) do |path, obj1, obj2|
case path
when 'b[*]'
raise "#{obj1} == #{obj2}"
end
end
=> [["~", "a", "car", "bus"], ["-", "b[1]", "plane"], ["+", "b[1]", " plan"]]
It doesn't seem to make any difference what goes in the block as a custom comparator.
Also, when I do a puts inside the block to try and figure out what is going on there is no output?!
The raise is silently rescued?!
The text was updated successfully, but these errors were encountered:
vs.
vs.
It doesn't seem to make any difference what goes in the block as a custom comparator.
Also, when I do a
puts
inside the block to try and figure out what is going on there is no output?!The
raise
is silently rescued?!The text was updated successfully, but these errors were encountered: