Module: Olyx::Guardrails::PolicyComponents::NormalizedPatternMatcher

Defined in:
lib/olyx/guardrails/policy/normalized_pattern_matcher.rb

Overview

Finds normalized policy matches and maps them to original offsets.

Class Method Summary collapse

Class Method Details

.call(source, rule, index, pattern) ⇒ Object



12
13
14
15
16
17
# File 'lib/olyx/guardrails/policy/normalized_pattern_matcher.rb', line 12

def call(source, rule, index, pattern)
  mapped = Text::MappedNormalization.new(source)
  return [] unless mapped.changed?

  findings(source, mapped, rule, index, pattern)
end