Module: Olyx::Guardrails::PolicyRuleComponents::RegexpCompiler
- Defined in:
- lib/olyx/guardrails/policy_rule/regexp_compiler.rb
Overview
Compiles bounded regular-expression policy patterns.
Constant Summary collapse
- TIMEOUT =
0.1
Class Method Summary collapse
Class Method Details
.call(value) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/olyx/guardrails/policy_rule/regexp_compiler.rb', line 12 def call(value) pattern = build(value) raise ArgumentError, 'policy rule patterns must not match empty text' if pattern.match?('') pattern rescue RegexpError => error raise ArgumentError, "invalid policy rule pattern #{value.inspect}: #{error.}" end |