diff_parser 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjAwOWVhZjIzMzExNDMxZDEyM2M2ZDBkYjU4ZWRmNmIwMjBkYTVmOA==
4
+ NTgzZTZmOGU3MWZhOTcwODUzNWE0YWFlMWIxZWFiYjI5MjkwYmJjNA==
5
5
  data.tar.gz: !binary |-
6
- ZDAzNWVkYTIzYjE1YTJlNWRiZTg5M2Y5YjdjOTg1ODQ5ZWQxM2E5Yg==
6
+ MzA4MGQ1Y2VlM2E4NDE2MzE2MmExOWJiODVmMDUxZDZkNDM5ZWFmNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzA0YTQ0YjAzNmJjODBlNjk3ZDgzMjM5NWQ3YTk2ZjBjYmQ2MzQyNTAzZDIz
10
- ZjBmMWI0Yzk3ZjUxMzk2ZDFmODRhZTdjM2NiYThhZmY2OWIxYjcyOTg1ZTdi
11
- YjM4NjcyMjEwMWFhNzYxOWZiZDQ2M2VlYTVkYjkyNzdkYjgxYzA=
9
+ NDAwODdmODk5MjA0MWQ5NTNmNjViNDZjZWFjMzQ1M2I4MzZkN2Y1MTllMTZj
10
+ OTIxOTMyYmQ1NDA4ZGU4NTJkN2U5YzY3ZWU3MzA5ZjFkNDE4NjM1OTY3Zjc2
11
+ ZGIzNWRiMDU4MmJjMDIwNTQxN2IxODIzYjI1ODgzYzkwNzYxM2U=
12
12
  data.tar.gz: !binary |-
13
- OTUzOTUyMWIwOGViMjhmY2MzMTllNTZlY2QwNTUxMmJiNTQxNWJmMjM3OWRk
14
- YTE4ZmQ0MjRhYWVmMmJiZTM2OWVhYzQwYzhkZjJjY2IwMDgzNTQ0ZjMzYzJk
15
- OTg5NGFiNmEyOWRhYmJlYWRjODI5OWY5ZWE3NmE4ZWExOWJlYjY=
13
+ Yjg3NzBiOGZjYzdhZDI0ZTIzMDMxZTY2Njc3ZGU0Y2E1Mzc1ZWY5MzgzZmVi
14
+ NjBmMTA0OTFlYzQ4OTdhOTA3YzY0ZmFkMWFmNTNmMzgyMDNmZDM1OTNhMzVj
15
+ ZjBjMzY3ZTY1YTBhMjRkNTU3MzZkZTg4OTQyMzZiZTk3NGQ0NTE=
@@ -15,13 +15,17 @@ module DiffParser
15
15
 
16
16
  def each
17
17
  current_file = nil
18
+ file_number = 0
18
19
 
19
20
  raw_lines.each_with_index do |raw_line, idx|
20
21
  next if raw_line.skip_line?
21
22
 
22
23
  if raw_line.info?
23
- yield current_file if current_file
24
- current_file = DiffParser::File.new(raw_line.full_line, diff)
24
+ if current_file
25
+ yield current_file
26
+ file_number += 1
27
+ end
28
+ current_file = DiffParser::File.new(raw_line.full_line, diff, file_number)
25
29
  elsif fold_file?(current_file)
26
30
  if options[:full] == current_file.path || options[:full] == true
27
31
  current_file.push_line(raw_line, idx)
@@ -1,15 +1,16 @@
1
1
  module DiffParser
2
2
  class File
3
3
  attr_accessor :line_old, :line_new, :lines
4
- attr_reader :path, :file_info, :diff
4
+ attr_reader :path, :file_info, :diff, :file_number
5
5
  delegate :additions, :deletions, to: :file_info
6
6
 
7
- def initialize(path, diff)
7
+ def initialize(path, diff, file_number=0)
8
8
  @path = preprocess_path(path)
9
9
  @diff = diff
10
10
  @lines = []
11
11
  @line_old = 1
12
12
  @line_new = 1
13
+ @file_number = file_number
13
14
  @file_info = retrieve_file_info(diff)
14
15
  end
15
16
 
@@ -1,3 +1,3 @@
1
1
  module DiffParser
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - stevo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2014-01-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Allows parsing diffs for presentation purposes - extracted from marvelous
14
14
  GitLab project