grit-ext 0.0.9 → 0.0.10

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.
data/README.md CHANGED
@@ -18,3 +18,13 @@ All of the extensions, additionally to normal grit classes, will be available to
18
18
  ## Diff#hunks
19
19
 
20
20
  [Diff#hunks](https://github.com/mmozuras/grit-ext/blob/master/lib/grit/ext/diff.rb) method returns an array of [DiffHunk](https://github.com/mmozuras/grit-ext/blob/master/lib/grit/ext/diff_hunk.rb). These hunks provide structured information about the diff.
21
+
22
+ ## Diff#repo
23
+
24
+ ## Diff#full_a_path
25
+
26
+ ## Diff#full_b_path
27
+
28
+ ## Diff#added
29
+
30
+ ## Diff#removed
data/lib/grit/ext/diff.rb CHANGED
@@ -12,15 +12,31 @@ module Grit
12
12
  end
13
13
 
14
14
  def full_a_path
15
- File.join(repo.working_dir, a_path)
15
+ full(a_path)
16
16
  end
17
17
 
18
18
  def full_b_path
19
- File.join(repo.working_dir, b_path)
19
+ full(b_path)
20
+ end
21
+
22
+ def added
23
+ hunks_lines {|h| h.added }
24
+ end
25
+
26
+ def removed
27
+ hunks_lines {|h| h.removed }
20
28
  end
21
29
 
22
30
  protected
23
31
 
32
+ def hunks_lines
33
+ hunks.collect { |h| yield(h) }.flatten
34
+ end
35
+
36
+ def full(path)
37
+ File.join(repo.working_dir, path)
38
+ end
39
+
24
40
  def lines
25
41
  @lines ||= diff.split("\n")
26
42
  end
@@ -1,5 +1,5 @@
1
1
  module Grit
2
2
  module Ext
3
- VERSION = '0.0.9'
3
+ VERSION = '0.0.10'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grit-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-18 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: grit