Class: Pronto::BigFiles::PatchWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/bigfiles/patch_wrapper.rb

Overview

Add convenience methods on top of Pronto::Git::Patch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patch) ⇒ PatchWrapper

Returns a new instance of PatchWrapper.



11
12
13
# File 'lib/pronto/bigfiles/patch_wrapper.rb', line 11

def initialize(patch)
  @patch = patch
end

Instance Attribute Details

#patchObject (readonly)

Returns the value of attribute patch.



9
10
11
# File 'lib/pronto/bigfiles/patch_wrapper.rb', line 9

def patch
  @patch
end

Instance Method Details

#added_to?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/pronto/bigfiles/patch_wrapper.rb', line 15

def added_to?
  (patch.additions - patch.deletions).positive?
end

#first_added_lineObject



23
24
25
# File 'lib/pronto/bigfiles/patch_wrapper.rb', line 23

def first_added_line
  patch.added_lines.first
end

#pathObject



19
20
21
# File 'lib/pronto/bigfiles/patch_wrapper.rb', line 19

def path
  patch.delta.new_file[:path]
end