Class: Evilution::Compare::LineNormalizer Private
- Inherits:
-
Object
- Object
- Evilution::Compare::LineNormalizer
- Defined in:
- lib/evilution/compare/line_normalizer.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.
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
- #call(line) ⇒ Object private
Instance Method Details
#call(line) ⇒ Object
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.
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 |