Class: Git::DiffPathStatus
- Inherits:
-
Object
- Object
- Git::DiffPathStatus
- Includes:
- Enumerable
- Defined in:
- lib/git/diff_path_status.rb
Overview
The files and their status (e.g., added, modified, deleted) between two commits
Instance Method Summary collapse
-
#each {|path, status| ... } ⇒ Enumerator, Hash{String => String}
Iterates over each file path and its status code.
-
#initialize(base_or_hash, from = nil, to = nil, path_limiter = nil) ⇒ DiffPathStatus
constructor
A new instance of DiffPathStatus.
-
#to_h ⇒ Hash{String => String}
Returns the name-status report as a hash.
Constructor Details
#initialize(base_or_hash, from = nil, to = nil, path_limiter = nil) ⇒ DiffPathStatus
Returns a new instance of DiffPathStatus.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/git/diff_path_status.rb', line 16 def initialize(base_or_hash, from = nil, to = nil, path_limiter = nil) if base_or_hash.is_a?(Hash) # New form: pre-fetched hash passed directly from Git::Repository::Diffing @fetch_path_status = base_or_hash else # Legacy form: (base, from, to, path_limiter) # Used by Git::Diff#path_status_provider and direct instantiation in tests. initialize_legacy(base_or_hash, from, to, path_limiter) end end |
Instance Method Details
#each {|path, status| ... } ⇒ Enumerator, Hash{String => String}
Iterates over each file path and its status code
43 44 45 46 47 |
# File 'lib/git/diff_path_status.rb', line 43 def each(&) return to_enum(__method__) unless block_given? fetch_path_status.each(&) end |
#to_h ⇒ Hash{String => String}
Returns the name-status report as a hash
56 57 58 |
# File 'lib/git/diff_path_status.rb', line 56 def to_h fetch_path_status end |