Class: Fluent::Compat::ExecUtil::TSVParser
- Defined in:
- lib/fluent/compat/exec_util.rb
Instance Method Summary collapse
- #call(io) ⇒ Object
- #each_line(line) ⇒ Object
-
#initialize(keys, on_message) ⇒ TSVParser
constructor
A new instance of TSVParser.
Constructor Details
#initialize(keys, on_message) ⇒ TSVParser
Returns a new instance of TSVParser.
59 60 61 62 |
# File 'lib/fluent/compat/exec_util.rb', line 59 def initialize(keys, ) @keys = keys super() end |
Instance Method Details
#call(io) ⇒ Object
64 65 66 |
# File 'lib/fluent/compat/exec_util.rb', line 64 def call(io) io.each_line(&method(:each_line)) end |
#each_line(line) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/fluent/compat/exec_util.rb', line 68 def each_line(line) line.chomp! vals = line.split("\t") record = Hash[@keys.zip(vals)] @on_message.call(record) end |