blob: 3686edb22d5eecd414f2c4d60e1af94d235f1061 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
module Git
# object that holds the last X commits on given branch
class Diff
include Enumerable
@base = nil
@from = nil
@to = nil
@full_diff = nil
def initialize(base, from = nil, to = nil)
dirty_log
@base = base
@from = from
@to = to
end
def
# enumerable methods
def each
cache_diff
@full_diff.each do |file|
yield file
end
end
private
def cache_diff
if !@full_diff
@full_diff = @base.lib.diff_files(@from, @to)
end
end
end
|