Method: Fluent::Plugin::RegexpParser#configure

Defined in:
lib/fluent/plugin/parser_regexp.rb

#configure(conf) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fluent/plugin/parser_regexp.rb', line 33

def configure(conf)
  super
  # For compat layer
  if @ignorecase || @multiline
    options = 0
    options |= Regexp::IGNORECASE if @ignorecase
    options |= Regexp::MULTILINE if @multiline
    @expression = Regexp.compile(@expression.source, options)
  end
  @regexp = @expression # For backward compatibility

  if @expression.named_captures.empty?
    raise Fluent::ConfigError, "No named captures in 'expression' parameter. The regexp must have at least one named capture"
  end
end