class Fluent::Compat::TextParser::RegexpParser

Public Class Methods

new(regexp, conf = {}) click to toggle source

TODO: warn when deprecated

Calls superclass method Fluent::Plugin::Parser::new
# File lib/fluent/compat/parser.rb, line 151
def initialize(regexp, conf = {})
  super()

  @stored_regexp = regexp
  @manually_configured = false
  unless conf.empty?
    conf_init = if conf.is_a?(Fluent::Config::Element)
                  conf
                else
                  Fluent::Config::Element.new('parse', '', conf, [])
                end
    self.configure(conf_init)
    @manually_configured = true
  end
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method Fluent::Plugin::RegexpParser#configure
# File lib/fluent/compat/parser.rb, line 167
def configure(conf)
  return if @manually_configured # not to run twice

  conf['expression'] ||= @stored_regexp.source
  conf['ignorecase'] ||= @stored_regexp.options & Regexp::IGNORECASE != 0
  conf['multiline'] ||= @stored_regexp.options & Regexp::MULTILINE != 0
  convert_type_converter_parameters!(conf)

  super
end
patterns() click to toggle source
# File lib/fluent/compat/parser.rb, line 178
def patterns
  {'format' => @regexp, 'time_format' => @time_format}
end