Class: Diff::LCS::Hunk

Class | Diff::LCS::Hunk
In: | lib/diff/lcs/hunk.rb
Parent: | Object

A Hunk is a group of Blocks which overlap because of the context surrounding each block. (So if we‘re not using context, every hunk will contain one block.) Used in the diff program (bin/diff).

### Methods

diff each_old new overlaps? unshift

### Attributes

blocks | [R] |
end_new | [R] |
end_old | [R] |
file_length_difference | [R] |
flag_context | [RW] | Change the "start" and "end" fields to note that context should be added to this hunk
start_new | [R] |
start_old | [R] |

### Public Class methods

new(data_old, data_new, piece, context, file_length_difference)

Create a hunk using references to both the old and new data, as well as the piece of data

### Public Instance methods

diff(format)
each_old(block) {|e| ...}
overlaps?(hunk = nil)

Is there an overlap between hunk arg0 and old hunk arg1? Note: if end of old hunk is one less than beginning of second, they overlap

unshift(hunk)

[Validate]