Sha256: 89434ec34f59a75dfacda7ae951069f7d992f227321d6f82e7e237d9718d4397
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 Bytes
Contents
require 'rom/types' module ROM module HTTP class Dataset module ResponseTransformers class Schemad attr_reader :schema def initialize(schema) @schema = Types::Hash.schema(schema) end def call(response, dataset) projections = dataset.projections if projections.size > 0 && schema.member_types.keys != projections projected_schema = Types::Hash.schema( schema.member_types.select { |k, _| projections.include?(k) } ) projected_schema[response] else response.map { |tuple| schema[tuple] } end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-http-0.5.0 | lib/rom/http/dataset/response_transformers/schemad.rb |