Class: Fluent::TextParser::CSVParser

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

#configure, #values_map

Methods included from TypeConverter

#configure, included

Methods inherited from Parser

#call, #configure

Methods included from Configurable

#config, #configure, included, lookup_type, register_type

Constructor Details

#initializeCSVParser

Returns a new instance of CSVParser.



435
436
437
438
# File 'lib/fluent/parser.rb', line 435

def initialize
  super
  require 'csv'
end

Instance Method Details

#parse(text) ⇒ Object



440
441
442
443
444
445
446
# File 'lib/fluent/parser.rb', line 440

def parse(text)
  if block_given?
    yield values_map(CSV.parse_line(text))
  else
    return values_map(CSV.parse_line(text))
  end
end