class Diff::LCS::Hunk

def initialize(data_old, data_new, piece, flag_context, file_length_difference)

piece of data.
Create a hunk using references to both the old and new data, as well as the
def initialize(data_old, data_new, piece, flag_context, file_length_difference)
  # At first, a hunk will have just one Block in it
  @blocks = [Diff::LCS::Block.new(piece)]
  if String.method_defined?(:encoding)
    @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0, '')).encoding
  end
  @data_old = data_old
  @data_new = data_new
  before = after = file_length_difference
  after += @blocks[0].diff_size
  @file_length_difference = after # The caller must get this manually
  @max_diff_size = @blocks.lazy.map { |e| e.diff_size }.max
  # Save the start & end of each array. If the array doesn't exist (e.g.,
  # we're only adding items in this block), then figure out the line
  # number based on the line number of the other file and the current
  # difference in file lengths.
  if @blocks[0].remove.empty?
    a1 = a2 = nil
  else
    a1 = @blocks[0].remove[0].position
    a2 = @blocks[0].remove[-1].position
  end
  if @blocks[0].insert.empty?
    b1 = b2 = nil
  else
    b1 = @blocks[0].insert[0].position
    b2 = @blocks[0].insert[-1].position
  end
  @start_old = a1 || (b1 - before)
  @start_new = b1 || (a1 + before)
  @end_old   = a2 || (b2 - after)
  @end_new   = b2 || (a2 + after)
  self.flag_context = flag_context
end