Class: Evilution::Compare::LineNormalizer
- Inherits:
-
Object
- Object
- Evilution::Compare::LineNormalizer
- Defined in:
- lib/evilution/compare/line_normalizer.rb
Overview
Collapses whitespace runs in source-code text while preserving the contents of “…” and ‘…’ string literals. Used for fingerprinting mutation diffs so that whitespace-only differences do not cause false fingerprint mismatches across tooling (evilution vs mutant).
v1 limitation: only “ and ‘ literals are preserved. Regex literals (/…/), heredocs, %w[], %q{} forms are treated as ordinary code — whitespace runs inside them collapse. A mutation touching whitespace inside a regex may false-match across tools.
Instance Method Summary collapse
Instance Method Details
#call(line) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/evilution/compare/line_normalizer.rb', line 19 def call(line) @chars = line.chars @i = 0 @out = +"" @in_literal = nil @last_was_space = false @i += step while @i < @chars.length result = @out.rstrip @chars = nil @out = nil result end |