Sha256: a85e49a2daaab2bec42633a41a6d83a347f811396b8ffdb2df667e5cd92ee184

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

require "dry/core/container"
require "dry/types"

module Dry
  module Schema
    # A class to build containers for custom types, which can be used in schemas
    #
    # @example
    #   MyTypeContainer = Dry::Schema::TypeContainer.new
    #   MyTypeContainer.register('params.fancy_string', Types::FancyString)
    #
    # @api public
    class TypeContainer
      include ::Dry::Core::Container::Mixin

      def initialize(types_container = ::Dry::Types.container)
        super()

        merge(types_container)
      end

      alias_method :registered?, :key?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-schema-1.14.0 lib/dry/schema/type_container.rb