File: patch.rb

package info (click to toggle)
ruby-rugged 0.24.0%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 728 kB
  • ctags: 737
  • sloc: ansic: 7,917; ruby: 607; makefile: 3
file content (36 lines) | stat: -rw-r--r-- 652 bytes parent folder | download
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
module Rugged
  class Patch
    include Enumerable
    alias each each_hunk

    alias size hunk_count
    alias count hunk_count

    attr_accessor :owner
    alias diff owner

    def inspect
      "#<#{self.class.name}:#{object_id}>"
    end

    # Returns the number of additions in the patch.
    def additions
      stat[0]
    end

    # Returns the number of deletions in the patch.
    def deletions
      stat[1]
    end

    # Returns the number of total changes in the patch.
    def changes
      additions + deletions
    end

    # Returns an Array containing all hunks of the patch.
    def hunks
      each_hunk.to_a
    end
  end
end