class Git::Diff
object that holds the diff between two commits
Attributes
Public Class Methods
Source
# File lib/git/diff.rb, line 11 def initialize(base, from = nil, to = nil) @base = base @from = from&.to_s @to = to&.to_s @path = nil @full_diff_files = nil end
Public Instance Methods
Source
# File lib/git/diff.rb, line 31 def [](key) process_full @full_diff_files.assoc(key)[1] end
Source
# File lib/git/diff.rb, line 36 def each(&) process_full @full_diff_files.map { |file| file[1] }.each(&) end
Source
# File lib/git/diff.rb, line 49 def name_status path_status_provider.to_h end
DEPRECATED METHODS
Source
# File lib/git/diff.rb, line 26 def patch @base.lib.diff_full(@from, @to, { path_limiter: @path }) end
Also aliased as: to_s
Source
# File lib/git/diff.rb, line 65 def stats { files: stats_provider.files, total: stats_provider.total } end
Private Instance Methods
Source
# File lib/git/diff.rb, line 111 def path_status_provider @path_status_provider ||= Git::DiffPathStatus.new(@base, @from, @to, @path) end
Source
# File lib/git/diff.rb, line 105 def process_full return if @full_diff_files @full_diff_files = process_full_diff end
Source
# File lib/git/diff.rb, line 119 def process_full_diff FullDiffParser.new(@base, patch).parse end
Source
# File lib/git/diff.rb, line 115 def stats_provider @stats_provider ||= Git::DiffStats.new(@base, @from, @to, @path) end