Sha256: 948b937c22ae05a07b730df33cb905d1c7545636804fe928cfabee8a22a28135

Contents?: true

Size: 611 Bytes

Versions: 5

Compression:

Stored size: 611 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

5 entries across 5 versions & 1 rubygems

Version Path
dry-schema-1.13.3 lib/dry/schema/type_container.rb
dry-schema-1.13.2 lib/dry/schema/type_container.rb
dry-schema-1.13.1 lib/dry/schema/type_container.rb
dry-schema-1.13.0 lib/dry/schema/type_container.rb
dry-schema-1.12.0 lib/dry/schema/type_container.rb