Class: Git::Status::StatusFileFactory Private

Inherits:
Object
  • Object
show all
Defined in:
lib/git/status.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 factory class responsible for fetching git status data and building a hash of StatusFile objects.

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ StatusFileFactory

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.

Create a new factory backed by the given git object

When base is a Repository (which exposes #diff_index directly), it is used as the data provider. When base is a Base (the legacy path), base.lib is used instead.

Parameters:



291
292
293
294
295
296
# File 'lib/git/status.rb', line 291

def initialize(base)
  @base = base
  # When base is Git::Repository (which exposes #diff_index directly),
  # use it as the data provider. Otherwise use base.lib (legacy path).
  @provider = base.respond_to?(:diff_index) ? base : base.lib
end

Instance Method Details

#construct_filesHash{String => Git::Status::StatusFile}

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.

Gather all status data and build a hash of file paths to StatusFile objects

Returns:



303
304
305
306
307
308
# File 'lib/git/status.rb', line 303

def construct_files
  files_data = fetch_all_files_data
  files_data.transform_values do |data|
    StatusFile.new(@base, data)
  end
end