Class: Git::DiffFileNumstatInfo Private

Inherits:
Data
  • Object
show all
Defined in:
lib/git/diff_file_numstat_info.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.

Immutable value object representing stats for a single file from git numstat output

Work in progress; this class is internal for now and may be made public in a future release.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deletionsInteger (readonly)

Returns number of lines deleted.

Returns:

  • (Integer)

    number of lines deleted



22
23
24
25
26
27
28
29
30
# File 'lib/git/diff_file_numstat_info.rb', line 22

DiffFileNumstatInfo = Data.define(:path, :src_path, :insertions, :deletions) do
  # Check if this file was renamed
  #
  # @return [Boolean] true if the file was renamed
  #
  def renamed?
    !src_path.nil?
  end
end

#insertionsInteger (readonly)

Returns number of lines inserted.

Returns:

  • (Integer)

    number of lines inserted



22
23
24
25
26
27
28
29
30
# File 'lib/git/diff_file_numstat_info.rb', line 22

DiffFileNumstatInfo = Data.define(:path, :src_path, :insertions, :deletions) do
  # Check if this file was renamed
  #
  # @return [Boolean] true if the file was renamed
  #
  def renamed?
    !src_path.nil?
  end
end

#pathString (readonly)

Returns the file path (destination path for renames).

Returns:

  • (String)

    the file path (destination path for renames)



22
23
24
25
26
27
28
29
30
# File 'lib/git/diff_file_numstat_info.rb', line 22

DiffFileNumstatInfo = Data.define(:path, :src_path, :insertions, :deletions) do
  # Check if this file was renamed
  #
  # @return [Boolean] true if the file was renamed
  #
  def renamed?
    !src_path.nil?
  end
end

#src_pathString? (readonly)

Returns the source path for renamed files, nil otherwise.

Returns:

  • (String, nil)

    the source path for renamed files, nil otherwise



22
23
24
25
26
27
28
29
30
# File 'lib/git/diff_file_numstat_info.rb', line 22

DiffFileNumstatInfo = Data.define(:path, :src_path, :insertions, :deletions) do
  # Check if this file was renamed
  #
  # @return [Boolean] true if the file was renamed
  #
  def renamed?
    !src_path.nil?
  end
end

Instance Method Details

#renamed?Boolean

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.

Check if this file was renamed

Returns:

  • (Boolean)

    true if the file was renamed



27
28
29
# File 'lib/git/diff_file_numstat_info.rb', line 27

def renamed?
  !src_path.nil?
end