Sha256: cce55d83bdef9701bf765b4f3f2db9db220a2d04efa9156f9fa2619e1f8b0526

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 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

3 entries across 3 versions & 1 rubygems

Version Path
logstash-filter-translate-3.3.0 lib/logstash/filters/dictionary/csv_file.rb
logstash-filter-translate-3.2.3 lib/logstash/filters/dictionary/csv_file.rb
logstash-filter-translate-3.2.2 lib/logstash/filters/dictionary/csv_file.rb