Class: Fluent::Plugin::LabeledTSVParser
- Inherits:
-
ValuesParser
- Object
- Base
- Parser
- ValuesParser
- Fluent::Plugin::LabeledTSVParser
- Defined in:
- lib/fluent/plugin/parser_ltsv.rb
Direct Known Subclasses
Constant Summary
Constants included from Compat::TypeConverter
Compat::TypeConverter::Converters
Constants inherited from Parser
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary
Attributes inherited from Parser
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from ValuesParser
Methods included from Compat::TypeConverter
Methods inherited from Parser
Methods included from TimeMixin::Parser
Methods included from OwnedByMixin
Methods inherited from Base
#after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #close, #closed?, #configured?, #has_router?, #initialize, #inspect, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #terminate, #terminated?
Methods included from SystemConfig::Mixin
#system_config, #system_config_override
Methods included from Configurable
#config, included, #initialize, lookup_type, register_type
Constructor Details
This class inherits a constructor from Fluent::Plugin::Parser
Instance Method Details
#configure(conf) ⇒ Object
29 30 31 32 33 |
# 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)| ... } ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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 |