Sha256: 957bcc3fc02762ec00816b7284c205d17c3356db4ebd7a4b2fdfa8767e4e6b1a

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 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
        ::Array.wrap 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

3 entries across 3 versions & 1 rubygems

Version Path
remote_table-1.2.4 lib/remote_table/transformer.rb
remote_table-1.2.3 lib/remote_table/transformer.rb
remote_table-1.2.2 lib/remote_table/transformer.rb