Class: Git::FileDiffInfo Private
- Inherits:
-
Data
- Object
- Data
- Git::FileDiffInfo
- Defined in:
- lib/git/diff_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 a single file's diff information
FileDiffInfo encapsulates the parsed data from a unified diff for one file, including the file path, patch text, mode changes, object identifiers, and type.
This class is used by DiffInfo for the legacy diff API.
Work in progress; this class is internal for now and may be made public in a future release.
Instance Attribute Summary collapse
-
#binary ⇒ Boolean
readonly
Whether this is a binary file.
-
#dst ⇒ String
readonly
The destination blob object identifier.
-
#mode ⇒ String
readonly
The file mode (e.g., '100644' for regular files).
-
#patch ⇒ String
readonly
The full unified diff patch text for this file.
-
#path ⇒ String
readonly
The file path relative to the repository root.
-
#src ⇒ String
readonly
The source blob object identifier.
-
#type ⇒ String
readonly
The type of change: 'modified', 'new', 'deleted', 'renamed'.
Instance Method Summary collapse
-
#binary? ⇒ Boolean
private
Check if this is a binary file.
Instance Attribute Details
#binary ⇒ Boolean (readonly)
Returns whether this is a binary file.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#dst ⇒ String (readonly)
Returns the destination blob object identifier.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#mode ⇒ String (readonly)
Returns the file mode (e.g., '100644' for regular files).
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#patch ⇒ String (readonly)
Returns the full unified diff patch text for this file.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#path ⇒ String (readonly)
Returns the file path relative to the repository root.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#src ⇒ String (readonly)
Returns the source blob object identifier.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
#type ⇒ String (readonly)
Returns the type of change: 'modified', 'new', 'deleted', 'renamed'.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git/diff_info.rb', line 47 FileDiffInfo = Data.define( :path, :patch, :mode, :src, :dst, :type, :binary ) do # Check if this is a binary file # # @return [Boolean] true if the file is binary # def binary? binary end end |
Instance Method Details
#binary? ⇒ 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 is a binary file
60 61 62 |
# File 'lib/git/diff_info.rb', line 60 def binary? binary end |