git_diff_parser 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/git_diff_parser/patch.rb +6 -1
- data/lib/git_diff_parser/patches.rb +16 -0
- data/lib/git_diff_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8da1f6b3c0c23a9817c03fdb89486c727cf9261
|
4
|
+
data.tar.gz: f031a844a99b0e1f572a7cdb03c2f616e2f091f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba7288316be89ee86b500cae2b8fbad4cb02ad9bad960c1aa8407f009d7807a4c46c5a93caa818e4c5f96410f837ebebd70617bc177aeeef7c1d7db76f228295
|
7
|
+
data.tar.gz: 21fad9940a4459eee7f0be4741387fdba44a2a7d6522c94a64b07d521c14460edb1c34fa9fa71c299edfd231d5640f22a27a9b084dfd28fe8d6c554d8342e06c
|
@@ -4,11 +4,12 @@ module GitDiffParser
|
|
4
4
|
MODIFIED_LINE = /^\+(?!\+|\+)/
|
5
5
|
NOT_REMOVED_LINE = /^[^-]/
|
6
6
|
|
7
|
-
attr_accessor :file, :body
|
7
|
+
attr_accessor :file, :body, :hash
|
8
8
|
|
9
9
|
def initialize(body, options = {})
|
10
10
|
@body = body || ''
|
11
11
|
@file = options[:file] || options['file'] if options[:file] || options['file']
|
12
|
+
@hash = options[:hash] || options['hash'] if options[:hash] || options['hash']
|
12
13
|
end
|
13
14
|
|
14
15
|
def changed_lines
|
@@ -34,6 +35,10 @@ module GitDiffParser
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
def changed_line_numbers
|
39
|
+
changed_lines.map(&:number)
|
40
|
+
end
|
41
|
+
|
37
42
|
private
|
38
43
|
|
39
44
|
def lines
|
@@ -8,5 +8,21 @@ module GitDiffParser
|
|
8
8
|
def initialize(*args)
|
9
9
|
super Array.new(*args)
|
10
10
|
end
|
11
|
+
|
12
|
+
def files
|
13
|
+
map(&:file)
|
14
|
+
end
|
15
|
+
|
16
|
+
def hashes
|
17
|
+
map(&:hash)
|
18
|
+
end
|
19
|
+
|
20
|
+
def find_patch_by_file(file)
|
21
|
+
find { |patch| patch.file == file }
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_patch_by_hash(hash)
|
25
|
+
find { |patch| patch.hash == hash }
|
26
|
+
end
|
11
27
|
end
|
12
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_diff_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|