Sha256: 81972216b7169301471f3a6362bfb1680e8b15900e9f6c44e9c0409dca1c7a18
Contents?: true
Size: 920 Bytes
Versions: 6
Compression:
Stored size: 920 Bytes
Contents
# frozen_string_literal: true require 'dry/schema/constants' require 'dry/schema/types' module Dry module Schema # A simple wrapper around Dry::Types registry # # This is used internally by specialized processor sub-classes # # @api private class TypeRegistry # @api private attr_reader :types # @api private attr_reader :namespace # @api private def self.new(types = Dry::Types, namespace = :strict) super end # @api private def initialize(types, namespace = :strict) @types = types @namespace = namespace end # @api private def namespaced(ns) self.class.new(types, ns) end # @api private def [](name) key = [namespace, name].compact.join(DOT) type = types.registered?(key) ? types[key] : types[name.to_s] type end end end end
Version data entries
6 entries across 6 versions & 1 rubygems