Class: Pronto::Git::Patch
- Inherits:
-
Struct
- Object
- Struct
- Pronto::Git::Patch
- Extended by:
- Forwardable
- Defined in:
- lib/pronto/git/patch.rb
Instance Attribute Summary collapse
-
#patch ⇒ Object
Returns the value of attribute patch.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
- #added_lines ⇒ Object
- #additions ⇒ Object
- #blame(lineno) ⇒ Object
- #deleted_lines ⇒ Object
- #deletions ⇒ Object
- #lines ⇒ Object
- #new_file_full_path ⇒ Object
Instance Attribute Details
#patch ⇒ Object
Returns the value of attribute patch
3 4 5 |
# File 'lib/pronto/git/patch.rb', line 3 def patch @patch end |
#repo ⇒ Object
Returns the value of attribute repo
3 4 5 |
# File 'lib/pronto/git/patch.rb', line 3 def repo @repo end |
Instance Method Details
#added_lines ⇒ Object
28 29 30 |
# File 'lib/pronto/git/patch.rb', line 28 def added_lines lines.select(&:addition?) end |
#additions ⇒ Object
8 9 10 |
# File 'lib/pronto/git/patch.rb', line 8 def additions stat[0] end |
#blame(lineno) ⇒ Object
16 17 18 |
# File 'lib/pronto/git/patch.rb', line 16 def blame(lineno) repo.blame(new_file_path, lineno) end |
#deleted_lines ⇒ Object
32 33 34 |
# File 'lib/pronto/git/patch.rb', line 32 def deleted_lines lines.select(&:deletion?) end |
#deletions ⇒ Object
12 13 14 |
# File 'lib/pronto/git/patch.rb', line 12 def deletions stat[1] end |
#lines ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/pronto/git/patch.rb', line 20 def lines @lines ||= begin hunks.flat_map do |hunk| hunk.lines.map { |line| Line.new(line, self, hunk) } end end end |
#new_file_full_path ⇒ Object
36 37 38 |
# File 'lib/pronto/git/patch.rb', line 36 def new_file_full_path repo.path.join(new_file_path) end |