Sha256: 57ce30dc17b1519caa8bc561cb1b19b4676b5e2d95cccb15befbb847750aa3f0

Contents?: true

Size: 654 Bytes

Versions: 8

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

require_relative './base_processor'
require_relative './transform/csv_adapter'

class ActiveSet
  class TransformProcessor < BaseProcessor
    def process
      fail "Format #{format} is not currently supported as option for tranform" unless %w[csv].include?(format)

      adapter = adapter_for(format: format)
      output = adapter.new(@set, columns).process
      output[:set]
    end

    private

    def adapter_for(format:)
      return CSVAdapter if format == 'csv'
    end

    def format
      @instructions.get(:format).to_s.downcase
    end

    def columns
      @instructions.get(:columns)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activeset-0.5.8 lib/active_set/processors/transform_processor.rb
activeset-0.5.7 lib/active_set/processors/transform_processor.rb
activeset-0.5.6 lib/active_set/processors/transform_processor.rb
activeset-0.5.5 lib/active_set/processors/transform_processor.rb
activeset-0.5.4 lib/active_set/processors/transform_processor.rb
activeset-0.5.3 lib/active_set/processors/transform_processor.rb
activeset-0.5.2 lib/active_set/processors/transform_processor.rb
activeset-0.5.1 lib/active_set/processors/transform_processor.rb