class Fluent::Plugin::LabeledTSVParser

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method Fluent::Plugin::ValuesParser#configure
# File lib/fluent/plugin/parser_ltsv.rb, line 29
def configure(conf)
  # this assignment is not to raise ConfigError in ValuesParser#configure
  conf['keys'] = conf['time_key'] || 'time'
  super(conf)
end
parse(text) { |values_map(values)| ... } click to toggle source
# File lib/fluent/plugin/parser_ltsv.rb, line 35
def parse(text)
  # TODO: thread unsafe: @keys might be changed by other threads
  @keys  = []
  values = []

  text.split(delimiter).each do |pair|
    key, value = pair.split(label_delimiter, 2)
    @keys.push(key)
    values.push(value)
  end

  yield values_map(values)
end