diffy
diffy copied to clipboard
Command line option override not working as advertised
Diffy 3.0.6 Ruby 2.1.3 diffutils 3.3
https://github.com/samg/diffy#overriding-the-command-line-options-passed-to-diff claims
>> puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w")
foo
bar
But when I try:
2.1.3p242 :001 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w")
=> nil
or even with a blank override:
2.1.3p242 :002 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "")
=> nil
but works with no override:
2.1.3p242 :003 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n")
- foo
+foo
bar
=> nil
Looks like you're right.
I think you can accomplish what you want with syntax like this:
Diffy::Diff.new("foo\nbaz", "foo \nbar\n", :diff => ["-U 10000", "-w"])
I'll look into updating the readme and or fixing this weird behavior.
Hi,
Just to confirm the behaviour and the fix/workaround: in my case,
hash_diff = Diffy::Diff.new(source, destination, :diff => ["-U 10000", "-E", "-b"]).to_s(:html)
works just as expected