Sha256: 1a965c9700d532948c1f60bdf718b595ce10caf18204e7da2d9774504dc2fdc9
Contents?: true
Size: 940 Bytes
Versions: 3
Compression:
Stored size: 940 Bytes
Contents
require 'dry/types/hash/schema' module Dry module Types class Hash < Definition def schema(type_map, klass = Schema) member_types = type_map.each_with_object({}) { |(name, type), result| result[name] = case type when String, Class then Types[type] else type end } klass.new(primitive, options.merge(member_types: member_types)) end def weak(type_map) schema(type_map, Weak) end def permissive(type_map) schema(type_map, Permissive) end def strict(type_map) schema(type_map, Strict) end def strict_with_defaults(type_map) schema(type_map, StrictWithDefaults) end def symbolized(type_map) schema(type_map, Symbolized) end private def resolve_missing_value(_result, _key, _type) # noop end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-types-0.9.2 | lib/dry/types/hash.rb |
dry-types-0.9.1 | lib/dry/types/hash.rb |
dry-types-0.9.0 | lib/dry/types/hash.rb |