Sha256: 2ddbfe8dfddaf12fac6621ac0d8b20f7462cafa24bd57b16be8dbb173fc59ffd

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

class RemoteTable
  class Transformer
    attr_reader :t
    def initialize(t)
      @t = t
    end
    # eventually this will support a different way of specifying a transformer
    def transform(row)
      if legacy_transformer
        legacy_transformer.apply row
      else
        [row]
      end
    end
    def legacy_transformer
      return @legacy_transformer if @legacy_transformer
      return unless t.options['transform']
      transform_options = t.options['transform'].dup
      transform_options.stringify_keys!
      @legacy_transformer = transform_options['class'].new transform_options.except('class')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
remote_table-1.2.1 lib/remote_table/transformer.rb
remote_table-1.2.0 lib/remote_table/transformer.rb