Sha256: e0327f558451b95e94db3990efe888bb259594e4d6890d7ea7e81f0c746dec84

Contents?: true

Size: 340 Bytes

Versions: 16

Compression:

Stored size: 340 Bytes

Contents

module Datacaster
  class Transformer < Base
    def initialize(&block)
      raise "Expected block" unless block_given?

      @transform = block
    end

    def cast(object, runtime:)
      Datacaster.ValidResult(Runtimes::Base.(runtime, @transform, object))
    end

    def inspect
      "#<Datacaster::Transformer>"
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
datacaster-3.3.1 lib/datacaster/transformer.rb
datacaster-3.3.0 lib/datacaster/transformer.rb
datacaster-3.2.7 lib/datacaster/transformer.rb
datacaster-3.2.6 lib/datacaster/transformer.rb
datacaster-3.2.5 lib/datacaster/transformer.rb
datacaster-3.2.4 lib/datacaster/transformer.rb
datacaster-3.2.3 lib/datacaster/transformer.rb
datacaster-3.2.2 lib/datacaster/transformer.rb
datacaster-3.2.1 lib/datacaster/transformer.rb
datacaster-3.2.0 lib/datacaster/transformer.rb
datacaster-3.1.5 lib/datacaster/transformer.rb
datacaster-3.1.3 lib/datacaster/transformer.rb
datacaster-3.1.2 lib/datacaster/transformer.rb
datacaster-3.1.1 lib/datacaster/transformer.rb
datacaster-3.1.0 lib/datacaster/transformer.rb
datacaster-3.0.0 lib/datacaster/transformer.rb