Class: CleoQualityReview::ChangesDiff
- Inherits:
-
Object
- Object
- CleoQualityReview::ChangesDiff
- Defined in:
- lib/cleo_quality_review/changes_diff.rb
Overview
Captures the git diff used for a quality review run
Instance Method Summary collapse
-
#initialize(target_files:, command_runner:) ⇒ ChangesDiff
constructor
A new instance of ChangesDiff.
-
#review_id ⇒ String
Deterministic review identifier for this diff.
-
#to_s ⇒ String
Combined tracked and untracked diff content.
Constructor Details
#initialize(target_files:, command_runner:) ⇒ ChangesDiff
Returns a new instance of ChangesDiff.
14 15 16 17 |
# File 'lib/cleo_quality_review/changes_diff.rb', line 14 def initialize(target_files:, command_runner:) @target_files = target_files @command_runner = command_runner end |
Instance Method Details
#review_id ⇒ String
Returns deterministic review identifier for this diff.
27 28 29 |
# File 'lib/cleo_quality_review/changes_diff.rb', line 27 def review_id Digest::SHA256.hexdigest(to_s) end |
#to_s ⇒ String
Returns combined tracked and untracked diff content.
21 22 23 |
# File 'lib/cleo_quality_review/changes_diff.rb', line 21 def to_s @to_s ||= [tracked_changes_diff, untracked_changes_diff].reject(&:empty?).join("\n") end |