Class: Fluent::Compat::ExecUtil::TSVFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/fluent/compat/exec_util.rb

Instance Method Summary collapse

Constructor Details

#initialize(in_keys) ⇒ TSVFormatter

Returns a new instance of TSVFormatter.



100
101
102
103
# File 'lib/fluent/compat/exec_util.rb', line 100

def initialize(in_keys)
  @in_keys = in_keys
  super()
end

Instance Method Details

#call(record, out) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/fluent/compat/exec_util.rb', line 105

def call(record, out)
  last = @in_keys.length-1
  for i in 0..last
    key = @in_keys[i]
    out << record[key].to_s
    out << "\t" if i != last
  end
  out << "\n"
end