Class: Embulk::Filter::QueryStringRuby
- Inherits:
-
FilterPlugin
- Object
- FilterPlugin
- Embulk::Filter::QueryStringRuby
- Defined in:
- lib/embulk/filter/query_string_ruby.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transaction(config, in_schema) {|task, out_columns| ... } ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/embulk/filter/query_string_ruby.rb', line 9 def self.transaction(config, in_schema, &control) task = { "target_column" => in_schema.find{|c| c.name == config.param("column", :string)}, "schema" => config.param("schema", :array, :default => []) } out_columns = in_schema + task["schema"].map {|col| Column.new(nil, col["name"], col["type"].to_sym)} yield(task, out_columns) end |
Instance Method Details
#add(page) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/embulk/filter/query_string_ruby.rb', line 27 def add(page) page.each do |record| q = query_parser(record[@target_column["index"]]) add_record = make_record(@schema, q) page_builder.add(record + add_record) end end |
#close ⇒ Object
24 25 |
# File 'lib/embulk/filter/query_string_ruby.rb', line 24 def close end |
#finish ⇒ Object
35 36 37 |
# File 'lib/embulk/filter/query_string_ruby.rb', line 35 def finish page_builder.finish end |
#init ⇒ Object
19 20 21 22 |
# File 'lib/embulk/filter/query_string_ruby.rb', line 19 def init @schema = task["schema"] @target_column = task["target_column"] end |