Class: Grit::Diff

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



3
4
5
# File 'lib/grit/ext/diff.rb', line 3

def repo
  @repo
end

Instance Method Details

#hunksObject



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

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