Class: Grit::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/grit/ext/diff.rb

Instance Method Summary collapse

Instance Method Details

#hunksObject



3
4
5
6
7
8
9
10
# File 'lib/grit/ext/diff.rb', line 3

def hunks
  header_lines.each_with_index
              .map { |header, index|
    next_header = header_lines[index + 1]
    next_line_number = next_header ? next_header[1] : lines.count
    DiffHunk.new(header[0], lines[header[1], next_line_number - 1])
  }
end