Sha256: 51e5db0c1042f1955f959b1d3c073f653309a3005ba4e9f1ff3661f9f0817b4f

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# Copyright:: (c) Autotelik Media Ltd 2016
# Author ::   Tom Statter
# Date ::     Feb 2016
# License::   MIT
#
# Details::   Class to manage the removal of unwanted columns or data
#

module DataShift

  module Transformation

    class Remove

      def remove_list
        @remove_list ||= DataShift::Configuration.call.prep_remove_list
      end

      def association?(mm)
        return false unless(mm.association_type?)
        DataShift::Configuration.call.exclude_associations.include?(mm.operator)
      end

      # Specify columns to remove via DataShift::Exporters::Configuration
      #
      def unwanted_columns( columns )
        columns.delete_if { |r| remove_list.include?( r.to_sym ) } unless remove_list.empty?
      end

      def unwanted_headers( headers )
        headers.delete_if { |r| remove_list.include?( r.source.to_sym ) } unless remove_list.empty?
      end

      # Specify columns to remove via DataShift::Exporters::Configuration
      #
      def unwanted_model_methods( model_methods )
        model_methods.delete_if { |r| remove_list.include?( r.operator.to_sym ) } unless remove_list.empty?
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datashift-0.40.1 lib/datashift/transformation/remove.rb
datashift-0.40.0 lib/datashift/transformation/remove.rb