Sha256: 20cef7f888c7810734aaa1d4e86ad6bafa702cf3412f6a5ffff698bdeb289cd8

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

# encoding: utf-8
require "csv"

module LogStash module Filters module Dictionary
  class CsvFile < File

    protected

    def initialize_for_file_type
      @io = StringIO.new("")
      @csv = CSV.new(@io)
    end

    def read_file_into_dictionary
      # low level CSV read that tries to create as
      # few intermediate objects as possible
      # this overwrites the value at key
      IO.foreach(@dictionary_path, :mode => 'r:bom|utf-8') do |line|
        @io.string = line
        k,v = @csv.shift
        @dictionary[k] = v
      end
    end
  end
end end end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstash-filter-translate-3.2.1 lib/logstash/filters/dictionary/csv_file.rb
logstash-filter-translate-3.2.0 lib/logstash/filters/dictionary/csv_file.rb