Sha256: 0c0bbe4523918f47fc8a27f736e7604b59a9623f812be3a6ffba4dd95ecb06a6

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

module Embulk
  module Filter

    class <%= ruby_class_name %> < FilterPlugin
      Plugin.register_filter(<%= name %>, self)

      def self.transaction(config, in_schema, &control)
        # configuration code:
        task = {
          "property1" => config.param("property1", :string)
          "property2" => config.param("property2", :integer, default: 0)
        }

        yield(task, out_columns)
      end

      def init
        # initialization code:
        @property1 = task["property1"]
        @property2 = task["property2"]
      end

      def close
      end

      def add(page)
        # filtering code:
        page.each do |record|
          @page_builder.add(record)
        end
      end

      def finish
        @page_builder.finish
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-0.4.1 lib/embulk/data/new/ruby/filter.rb.erb
embulk-0.4.0 lib/embulk/data/new/ruby/filter.rb.erb