Sha256: 071fed5669aef642f4c655cecfd30a52a6078183aea106bf975c130e65e5ffa7

Contents?: true

Size: 638 Bytes

Versions: 11

Compression:

Stored size: 638 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

11 entries across 11 versions & 1 rubygems

Version Path
remote_table-1.1.10 lib/remote_table/transformer.rb
remote_table-1.1.9 lib/remote_table/transformer.rb
remote_table-1.1.8 lib/remote_table/transformer.rb
remote_table-1.1.7 lib/remote_table/transformer.rb
remote_table-1.1.6 lib/remote_table/transformer.rb
remote_table-1.1.4 lib/remote_table/transformer.rb
remote_table-1.1.3 lib/remote_table/transformer.rb
remote_table-1.1.2 lib/remote_table/transformer.rb
remote_table-1.1.1 lib/remote_table/transformer.rb
remote_table-1.1.0 lib/remote_table/transformer.rb
remote_table-1.0.3 lib/remote_table/transformer.rb