Parent

Included Modules

Class/Module Index [+]

Quicksearch

Fluent::TextParser::JSONParser

Attributes

estimate_current_event[RW]

SET false BEFORE CONFIGURE, to return nil when time not parsed ‘configure()’ may raise errors for unexpected configurations

Public Class Methods

new() click to toggle source
# File lib/fluent/parser.rb, line 207
def initialize
  super
  @estimate_current_event = true
end

Public Instance Methods

call(text) click to toggle source
# File lib/fluent/parser.rb, line 221
def call(text)
  record = Yajl.load(text)

  if value = record.delete(@time_key)
    if @time_format
      time = @mutex.synchronize { @time_parser.parse(value) }
    else
      time = value.to_i
    end
  else
    if @estimate_current_event
      time = Engine.now
    else
      time = nil
    end
  end

  if block_given?
    yield time, record
  else
    return time, record
  end
rescue Yajl::ParseError
  if block_given?
    yield nil, nil
  else
    return nil, nil
  end
end
configure(conf) click to toggle source
# File lib/fluent/parser.rb, line 212
def configure(conf)
  super

  unless @time_format.nil?
    @time_parser = TimeParser.new(@time_format)
    @mutex = Mutex.new
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.