Allow ignoring different line endings?
Hi there,
thanks for making diffy! Helped a lot in a current task :)
One thing though, is there an option or would you want there to be an option to ignore different line endings?
E.g.
2.0.0-p451 :001 > string1 = "Hello there!\nWhat a beautiful day\n"
=> "Hello there!\nWhat a beautiful day\n"
2.0.0-p451 :002 > string2 = string1.clone.gsub "\n", "\r\n"
=> "Hello there!\r\nWhat a beautiful day\r\n"
2.0.0-p451 :003 > Diffy::Diff.new(string1, string2).to_s
=> "-Hello there!\n-What a beautiful day\n+Hello there!\r\n+What a beautiful day\r\n"
bit me in the project (data is saved with UNIX line endings, comes in through the browser with /r/n)
I know it's a matter of a simple gsub, which is my current workaround, but I think it'd be a nice feature to have (or thing to mention in the README if it exists already, didn't find it)
Cheers and thanks! Tobi
I'm not at all opposed to this idea, though it's unlikely I'll have time to implement it in the short term. It is possible to override the options passed to unix diff (https://github.com/samg/diffy#overriding-the-command-line-options-passed-to-diff) and to write your own output formatters (https://github.com/samg/diffy#custom-formats) though this could be a convenient option for the use case you describe. A quick peruse of the man diff doesn't reveal an option for ignoring different line endings so it looks like something diffy would have to handle. I'd be happy to review a pull request. Thanks!