samg / diffy

Easy Diffing in Ruby
http://rubygems.org/gems/diffy
MIT License
1.26k stars 103 forks source link

Add each_hunk method #93

Closed strongoose closed 6 years ago

strongoose commented 6 years ago

This method allows iteration over "change hunks", groups of contiguous additions or deletions surrounded by unchanged context lines.

Don't have an issue raised for this, hope that's ok!

strongoose commented 6 years ago

Have found an issue relating to the way that the :allow_empty_diff option

samg commented 6 years ago

Maybe take a look at Diffy::Diff#each_chunk https://github.com/samg/diffy/blob/master/lib/diffy/diff.rb#L97-L108

I think it may do something similar.