Sha256: 22064933e523b042797492a71083303436fcca63bbad16b868fec4615c309577

Contents?: true

Size: 688 Bytes

Versions: 31

Compression:

Stored size: 688 Bytes

Contents

module ETL #:nodoc:
  module Processor #:nodoc:
    # Row level processor to rename a field in the row.
    #
    # Configuration options:
    # * <tt>:source</tt>: the source field name
    # * <tt>:dest</tt>: The destination field name
    class RenameProcessor < ETL::Processor::RowProcessor
      def process(row)
        source_value = row[configuration[:source]]
        case source_value
        when Numeric
          row[configuration[:dest]] = source_value
        when nil
          row[configuration[:dest]] = nil
        else
          row[configuration[:dest]] = source_value.dup
        end
        row.delete(configuration[:source])
        row
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 9 rubygems

Version Path
aeden-activewarehouse-etl-0.9.1 etl/lib/etl/processor/rename_processor.rb
colincasey-activewarehouse-etl-0.9.4 lib/etl/processor/rename_processor.rb
colincasey-activewarehouse-etl-0.9.5 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.2 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.3 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.4 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.5 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.6 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.7 lib/etl/processor/rename_processor.rb
jayzes-activewarehouse-etl-0.9.1.1 lib/etl/processor/rename_processor.rb
jayzes-activewarehouse-etl-0.9.1.2 lib/etl/processor/rename_processor.rb
jayzes-activewarehouse-etl-0.9.1 lib/etl/processor/rename_processor.rb
activewarehouse-etl-1.0.0 lib/etl/processor/rename_processor.rb
activewarehouse-etl-1.0.0.rc1 lib/etl/processor/rename_processor.rb
etl-0.9.5.rc1 lib/etl/processor/rename_processor.rb
activewarehouse-etl-sgonyea-0.9.6 lib/etl/processor/rename_processor.rb
activewarehouse-etl-0.9.5.rc1 lib/etl/processor/rename_processor.rb
darrell-activewarehouse-etl-0.9.1.6 lib/etl/processor/rename_processor.rb
darrell-activewarehouse-etl-0.9.1.4 lib/etl/processor/rename_processor.rb
factorylabs-activewarehouse-etl-0.9.1.8 lib/etl/processor/rename_processor.rb