Sha256: 1930b0283edbf992a20978d628d6f3bd5fc7a12751f349665e9e8a61e151e308
Contents?: true
Size: 1007 Bytes
Versions: 2
Compression:
Stored size: 1007 Bytes
Contents
require 'dry/schema/macros/value' module Dry module Schema module Macros # Macro used to specify a nested schema # # @api public class Hash < Value # @api private def call(*args, &block) trace << hash? super(*args) unless args.empty? if block definition = schema_dsl.new(&block) parent_type = schema_dsl.types[name] definition_schema = definition.type_schema schema_type = if parent_type.respond_to?(:of) parent_type.of(definition_schema) else definition_schema end final_type = if schema_dsl.maybe?(parent_type) schema_type.optional else schema_type end schema_dsl.set_type(name, final_type) trace << definition.to_rule end self end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-schema-0.1.1 | lib/dry/schema/macros/hash.rb |
dry-schema-0.1.0 | lib/dry/schema/macros/hash.rb |