Class: Fluent::Compat::ExecUtil::TextParserWrapperParser
- Defined in:
- lib/fluent/compat/exec_util.rb
Instance Method Summary collapse
- #call(io) ⇒ Object
- #each_line(line) ⇒ Object
-
#initialize(conf, on_message) ⇒ TextParserWrapperParser
constructor
A new instance of TextParserWrapperParser.
Constructor Details
#initialize(conf, on_message) ⇒ TextParserWrapperParser
Returns a new instance of TextParserWrapperParser.
40 41 42 43 44 |
# File 'lib/fluent/compat/exec_util.rb', line 40 def initialize(conf, ) @parser = Plugin.new_parser(conf['format']) @parser.configure(conf) super() end |
Instance Method Details
#call(io) ⇒ Object
46 47 48 |
# File 'lib/fluent/compat/exec_util.rb', line 46 def call(io) io.each_line(&method(:each_line)) end |
#each_line(line) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/fluent/compat/exec_util.rb', line 50 def each_line(line) line.chomp! @parser.parse(line) { |time, record| @on_message.call(record, time) } end |