Class: Rugged::Diff::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/rugged/diff/line.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



15
16
17
18
19
20
# File 'lib/pronto/rugged/diff/line.rb', line 15

def ==(other)
  content == other.content &&
    line_origin == other.line_origin &&
    old_lineno == other.old_lineno &&
    new_lineno == other.new_lineno
end

#patchObject



4
5
6
# File 'lib/pronto/rugged/diff/line.rb', line 4

def patch
  hunk.owner
end

#positionObject



8
9
10
11
12
13
# File 'lib/pronto/rugged/diff/line.rb', line 8

def position
  hunk_index = patch.hunks.find_index { |h| h.header == hunk.header }
  line_index = patch.lines.find_index(self)

  line_index + hunk_index + 1
end