class Fluent::TextParser::StdFormatTimeParser
Public Class Methods
new(format)
click to toggle source
Extend the standard TimeParser to be able to use methods for standard formats – in particular, for formats which can be represented by muliple hard-coded formats. For instance, the iso8601 format can be represented by either of the following formats (probably more) which are not interchangable as arguments to strptime – whether or not the tiemstamp has millisecond precision must be treated as two distinct formats if the available iso8601 method is not used:
-
'%y-%m-%dT%H:%M:%S%Z' (no fractional seconds)
-
'%y-%m-%dT%H:%M:%S.%L%Z' (fractional seconds)
Calls superclass method
# File lib/fluent/plugin/parser_jsonish.rb, line 17 def initialize(format) if not /%/.match(format) super() @parse = ->(v){ Fluent::EventTime.from_time(Time.method(format).call(v)) } else super(format) end end