Class: Fluent::TextParser::LabeledTSVParser

Inherits:
ValuesParser show all
Defined in:
lib/fluent/parser.rb

Constant Summary

Constants included from TypeConverter

TypeConverter::Converters

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

Attributes inherited from Parser

#estimate_current_event

Instance Method Summary collapse

Methods inherited from ValuesParser

#values_map

Methods included from TypeConverter

included

Methods inherited from Parser

#call, #initialize

Methods included from Configurable

#config, included, #initialize, lookup_type, register_type

Constructor Details

This class inherits a constructor from Fluent::Parser

Instance Method Details

#configure(conf) ⇒ Object



411
412
413
414
# File 'lib/fluent/parser.rb', line 411

def configure(conf)
  conf['keys'] = conf['time_key'] || 'time'
  super(conf)
end

#parse(text) ⇒ Object



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/fluent/parser.rb', line 416

def parse(text)
  @keys  = []
  values = []

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

  if block_given?
    yield values_map(values)
  else
    return values_map(values)
  end
end