Sha256: b64e4c9a77d96ab3c8006cd63835c8bac1de04b5025f70aebcf16de29b3e59e6

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

module Fluent
  module Mixin
    module TypeConverter
      include Configurable
      include RecordFilterMixin
      include Fluent::TextParser::TypeConverter

      attr_accessor :types, :types_delimiter, :types_label_delimiter

      def configure(conf)
        super

        if types = conf['types']
          @types = types
        end
 
        if types_delimiter = conf['types_delimiter']
          @types_delimiter = types_delimiter
        end
 
        if types_label_delimiter = conf['types_label_delimiter']
          @types_label_delimiter = types_label_delimiter
        end
      end

      def filter_record(tag, time, record)
        super
        if @types
          convert_field_type!(record)
        end
      end

      def convert_field_type!(record)
        record.each { |key, value|
          record[key] = convert_type(key, value)
        }
        self
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-mixin-type-converter-0.0.3 lib/fluent/mixin/type_converter.rb
fluent-mixin-type-converter-0.0.2 lib/fluent/mixin/type_converter.rb