Class: Canon::Diff::FormattingDetector
- Inherits:
-
Object
- Object
- Canon::Diff::FormattingDetector
- Defined in:
- lib/canon/diff/formatting_detector.rb
Overview
Detects if differences between lines are formatting-only (whitespace, line breaks) with no semantic content changes
Class Method Summary collapse
-
.formatting_only?(line1, line2) ⇒ Boolean
Detect if two lines differ only in formatting.
Class Method Details
.formatting_only?(line1, line2) ⇒ Boolean
Detect if two lines differ only in formatting
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/canon/diff/formatting_detector.rb', line 13 def self.formatting_only?(line1, line2) # If both are nil or empty, not a formatting diff (no difference) return false if blank?(line1) && blank?(line2) # If only one is blank, it's not just formatting return false if blank?(line1) || blank?(line2) # Compare normalized versions normalize_for_comparison(line1) == normalize_for_comparison(line2) end |