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

#addedObject



22
23
24
# File 'lib/grit/ext/diff.rb', line 22

def added
  hunks_lines {|h| h.added }
end

#full_a_pathObject



14
15
16
# File 'lib/grit/ext/diff.rb', line 14

def full_a_path
  full(a_path)
end

#full_b_pathObject



18
19
20
# File 'lib/grit/ext/diff.rb', line 18

def full_b_path
  full(b_path)
end

#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

#removedObject



26
27
28
# File 'lib/grit/ext/diff.rb', line 26

def removed
  hunks_lines {|h| h.removed }
end