Class: Pronto::Git::Line
- Inherits:
-
Struct
- Object
- Struct
- Pronto::Git::Line
- Extended by:
- Forwardable
- Defined in:
- lib/pronto/git/line.rb
Instance Attribute Summary collapse
-
#hunk ⇒ Object
Returns the value of attribute hunk.
-
#line ⇒ Object
Returns the value of attribute line.
-
#patch ⇒ Object
Returns the value of attribute patch.
Instance Method Summary collapse
Instance Attribute Details
#hunk ⇒ Object
Returns the value of attribute hunk
3 4 5 |
# File 'lib/pronto/git/line.rb', line 3 def hunk @hunk end |
#line ⇒ Object
Returns the value of attribute line
3 4 5 |
# File 'lib/pronto/git/line.rb', line 3 def line @line end |
#patch ⇒ Object
Returns the value of attribute patch
3 4 5 |
# File 'lib/pronto/git/line.rb', line 3 def patch @patch end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/pronto/git/line.rb', line 30 def ==(other) content == other.content && line_origin == other.line_origin && old_lineno == other.old_lineno && new_lineno == other.new_lineno end |
#commit_line ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/pronto/git/line.rb', line 20 def commit_line @commit_line ||= begin patches = patch.repo.show_commit(commit_sha) result = patches.find_line(patch.new_file_full_path, blame[:orig_start_line_number]) result || self # no commit_line means that it was just added end end |
#commit_sha ⇒ Object
16 17 18 |
# File 'lib/pronto/git/line.rb', line 16 def commit_sha blame[:final_commit_id] if blame end |
#position ⇒ Object
9 10 11 12 13 14 |
# File 'lib/pronto/git/line.rb', line 9 def position hunk_index = patch.hunks.find_index { |h| h.header == hunk.header } line_index = patch.lines.find_index(line) line_index + hunk_index + 1 end |