Module: Olyx::Guardrails::PolicyRuleComponents::TermCompiler

Defined in:
lib/olyx/guardrails/policy_rule/term_compiler.rb

Overview

Compiles literal terms without exposing regex semantics.

Class Method Summary collapse

Class Method Details

.call(term, mode:) ⇒ Object



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

def call(term, mode:)
  validate!(term)
  return RegexpCompiler.call(term) if mode == :regexp

  Regexp.new(source(term, mode), Regexp::IGNORECASE, timeout: RegexpCompiler::TIMEOUT)
end