Class: Git::Diff::FullDiffParser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/git/diff.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A private parser class to process the output of git diff

Instance Method Summary collapse

Constructor Details

#initialize(base, patch_text) ⇒ FullDiffParser

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FullDiffParser.



126
127
128
129
130
131
132
# File 'lib/git/diff.rb', line 126

def initialize(base, patch_text)
  @base = base
  @patch_text = patch_text
  @final_files = {}
  @current_file_data = nil
  @defaults = { mode: '', src: '', dst: '', type: 'modified', binary: false }
end

Instance Method Details

#parse

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



134
135
136
137
# File 'lib/git/diff.rb', line 134

def parse
  @patch_text.split("\n").each { |line| process_line(line) }
  @final_files.map { |filename, data| [filename, DiffFile.new(@base, data)] }
end