Sha256: d1096e5a33a2317e16760a643f5b5bc6cfc07caeec922193dcdf041626beb9fa
Contents?: true
Size: 1.14 KB
Versions: 42
Compression:
Stored size: 1.14 KB
Contents
module Embulk module Parser class ${rubyClassName} < ParserPlugin Plugin.register_parser("${name}", self) def self.transaction(config, &control) # configuration code: task = { "option1" => config.param("option1", :integer), # integer, required "option2" => config.param("option2", :string, default: "myvalue"), # string, optional "option3" => config.param("option3", :string, default: nil), # string, optional } columns = [ Column.new(0, "example", :string), Column.new(1, "column", :long), Column.new(2, "name", :double), ] yield(task, columns) end def init # initialization code: @option1 = task["option1"] @option2 = task["option2"] @option3 = task["option3"] end def run(file_input) while file = file_input.next_file file.each do |buffer| # parsering code record = ["col1", 2, 3.0] page_builder.add(record) end end page_builder.finish end end end end
Version data entries
42 entries across 42 versions & 1 rubygems