git_diff_parser 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef06c6a36cf828b1806d9f0f8be11fc136424dd1
4
- data.tar.gz: bec097bbfbc6e10e46d588ae9917383eb8750f7f
3
+ metadata.gz: b8da1f6b3c0c23a9817c03fdb89486c727cf9261
4
+ data.tar.gz: f031a844a99b0e1f572a7cdb03c2f616e2f091f2
5
5
  SHA512:
6
- metadata.gz: c80bd251554bd3183f0ea56de73b908d419fd2e113aa951347114ee225a4bd29d7445cf2a91819a6d5b7e4f62ae08cf49d8862bbd1bdfbb3afb236930cac40fc
7
- data.tar.gz: bfa1fb12689e07201dff3037ea1c763d32cdfc158ac3792dacbd990c75aa2bf6510b75390af758ba406e646658ce125f622c6af604b3acf7c3aa516416a8a73e
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
@@ -1,3 +1,3 @@
1
1
  module GitDiffParser
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  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.0.0
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-22 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler