lib/dry/schema/dsl.rb
# Build a key spec needed by the key map
#
# TODO: we need a key-map compiler using Types AST
#
# @api private
Build a key spec needed by the key map
TODO: we need a key-map compiler using Types AST
Build a key spec needed by the key map TODO : we need a key - map compiler using Types AST
def key_spec(name, type)
        if type.respond_to?(:keys)
          {name => key_map(type.name_key_map)}
        elsif type.respond_to?(:member)
          kv = key_spec(name, type.member)
          kv.equal?(name) ? name : kv.flatten(1)
        elsif type.meta[:maybe] && type.respond_to?(:right)
          key_spec(name, type.right)
        elsif type.respond_to?(:type)
          key_spec(name, type.type)
        else
          name
        end
      end
def key_spec ( name , type ) if type . respond_to? ( :keys ) { name => key_map ( type . name_key_map ) } elsif type . respond_to? ( :member ) kv = key_spec ( name , type . member ) kv . equal? ( name ) ? name : kv . flatten ( 1 ) elsif type . meta [ :maybe ] && type . respond_to? ( :right ) key_spec ( name , type . right ) elsif type . respond_to? ( :type ) key_spec ( name , type . type ) else name end end
Build a key spec needed by the key map
TODO: we need a key-map compiler using Types AST
Build a key spec needed by the key map TODO : we need a key - map compiler using Types AST
name
<not_specific>
type
<not_specific>
api
None