Class Git::Diff
In: lib/git/diff.rb
Parent: Object

object that holds the last X commits on given branch

Methods

[]   deletions   each   insertions   lines   new   patch   path   size   stats   to_s  

Included Modules

Enumerable

Classes and Modules

Class Git::Diff::DiffFile

Public Class methods

[Source]

# File lib/git/diff.rb, line 16
    def initialize(base, from = nil, to = nil)
      @base = base
      @from = from.to_s
      @to = to.to_s
    end

Public Instance methods

enumerable methods

[Source]

# File lib/git/diff.rb, line 61
    def [](key)
      process_full
      @full_diff_files.assoc(key)[1]
    end

[Source]

# File lib/git/diff.rb, line 37
    def deletions
      cache_stats
      @stats[:total][:deletions]
    end

[Source]

# File lib/git/diff.rb, line 66
    def each
      process_full
      @full_diff_files.each do |file|
        yield file[1]
      end
    end

[Source]

# File lib/git/diff.rb, line 42
    def insertions
      cache_stats
      @stats[:total][:insertions]
    end

[Source]

# File lib/git/diff.rb, line 32
    def lines
      cache_stats
      @stats[:total][:lines]
    end

if file is provided and is writable, it will write the patch into the file

[Source]

# File lib/git/diff.rb, line 53
    def patch(file = nil)
      cache_full
      @full_diff
    end

[Source]

# File lib/git/diff.rb, line 22
    def path(path)
      @path = path
      return self
    end

[Source]

# File lib/git/diff.rb, line 27
    def size
      cache_stats
      @stats[:total][:files]
    end

[Source]

# File lib/git/diff.rb, line 47
    def stats
      cache_stats
      @stats
    end
to_s(file = nil)

Alias for patch

[Validate]