Module: Olyx::Guardrails::PolicyComponents::RuleMatcher
- Defined in:
- lib/olyx/guardrails/policy/rule_matcher.rb
Overview
Collects original and normalized matches for one policy rule.
Constant Summary collapse
- TIMEOUT_ERROR =
defined?(Regexp::TimeoutError) ? Regexp::TimeoutError : RegexpError
Class Method Summary collapse
Class Method Details
.call(source, rule, index) ⇒ Object
15 16 17 18 19 |
# File 'lib/olyx/guardrails/policy/rule_matcher.rb', line 15 def call(source, rule, index) rule.patterns.flat_map { |pattern| matches(source, rule, index, pattern) } rescue TIMEOUT_ERROR raise ArgumentError, "policy rule #{rule.name.inspect} timed out" end |