class Fluent::Plugin::RegexpParser
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
Fluent::Plugin::Parser#configure
# File lib/fluent/plugin/parser_regexp.rb, line 30 def configure(conf) super expr = if @expression[0] == "/" && @expression[-1] == "/" @expression[1..-2] else @expression end regexp_option = 0 regexp_option |= Regexp::IGNORECASE if @ignorecase regexp_option |= Regexp::MULTILINE if @multiline @regexp = Regexp.new(expr, regexp_option) end
parse(text) { |nil, nil| ... }
click to toggle source
# File lib/fluent/plugin/parser_regexp.rb, line 44 def parse(text) m = @regexp.match(text) unless m yield nil, nil return end r = {} m.names.each do |name| if value = m[name] r[name] = value end end time, record = convert_values(parse_time(r), r) yield time, record end