Sha256: 0ae0a9a8ccfb596e5dcefc2223824dc2ea5e93424b00b7628d9bf38cd9d72613

Contents?: true

Size: 832 Bytes

Versions: 51

Compression:

Stored size: 832 Bytes

Contents

# Copyright (C) the Rugged contributors.  All rights reserved.
#
# This file is part of Rugged, distributed under the MIT license.
# For full terms see the included LICENSE file.

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

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
rugged-1.7.2 lib/rugged/patch.rb
rugged-1.6.5 lib/rugged/patch.rb
rugged-1.7.1 lib/rugged/patch.rb
rugged-1.6.3 lib/rugged/patch.rb
rugged-1.6.2 lib/rugged/patch.rb
rugged-1.5.1 lib/rugged/patch.rb
rugged-1.4.5 lib/rugged/patch.rb
rugged-1.5.0.1 lib/rugged/patch.rb
rugged-1.5.0 lib/rugged/patch.rb
rugged-1.3.2.3 lib/rugged/patch.rb
rugged-1.4.4 lib/rugged/patch.rb
rugged-1.3.2.1 lib/rugged/patch.rb
rugged-1.4.3 lib/rugged/patch.rb
rugged-1.3.2 lib/rugged/patch.rb
rugged-1.4.2 lib/rugged/patch.rb
rugged-1.3.1 lib/rugged/patch.rb
rugged-1.3.0 lib/rugged/patch.rb
rugged-1.2.0 lib/rugged/patch.rb
rugged-1.1.1 lib/rugged/patch.rb
rugged-1.1.0 lib/rugged/patch.rb