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-0.27.0 lib/rugged/patch.rb
rugged-0.26.3 lib/rugged/patch.rb
rugged-0.26.0 lib/rugged/patch.rb
rugged-0.26.0b5 lib/rugged/patch.rb
rugged-0.26.0b4 lib/rugged/patch.rb
rugged-0.26.0b3 lib/rugged/patch.rb
rugged-0.26.0b2 lib/rugged/patch.rb
rugged-0.26.0b1 lib/rugged/patch.rb
rugged-0.25.1.1 lib/rugged/patch.rb
rugged-0.25.1 lib/rugged/patch.rb
rugged-0.25.0 lib/rugged/patch.rb