Sha256: 373aeeb596fe078c32102cec80a4d8230828fda63ee8003dc1b2dbdda12ab359

Contents?: true

Size: 1020 Bytes

Versions: 4

Compression:

Stored size: 1020 Bytes

Contents

module ETL #:nodoc:
  module Processor #:nodoc:
    # Processor which processes a specific row. Unlike a transformer, which deals with a specific
    # value in the row, row processors can process an entire row at once, which can be used to 
    # explode a single row into multiple rows (for example)
    class RowProcessor < Processor
      # Initialize the processor
      def initialize(control, configuration)
        super
      end
      # Process the specified row. This method must return the row.
      def process(row)
        raise "process_row is an abstract method"
      end

      # Ensure a given row keys include all the provided columns
      # and raise an error using the provided message if it doesn't
      def ensure_columns_available_in_row!(row, columns, message)
        unless columns.nil?
          columns.each do |k|
            raise(ETL::ControlError, "Row missing required field #{k.inspect} #{message}") unless row.keys.include?(k)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
activewarehouse-etl-1.0.0 lib/etl/processor/row_processor.rb
activewarehouse-etl-1.0.0.rc1 lib/etl/processor/row_processor.rb
etl-0.9.5.rc1 lib/etl/processor/row_processor.rb
activewarehouse-etl-sgonyea-0.9.6 lib/etl/processor/row_processor.rb