Sha256: 24291f5a1b5797aab51510b04a2dda6d31762cdb59a7ed9d4fcd77fe26b7f5b4

Contents?: true

Size: 600 Bytes

Versions: 27

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

require "dry/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::Container::Mixin

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

        merge(types_container)
      end

      alias_method :registered?, :key?
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
dry-schema-1.11.3 lib/dry/schema/type_container.rb
dry-schema-1.11.2 lib/dry/schema/type_container.rb
dry-schema-1.11.1 lib/dry/schema/type_container.rb
dry-schema-1.11.0 lib/dry/schema/type_container.rb
dry-schema-1.10.6 lib/dry/schema/type_container.rb
dry-schema-1.10.5 lib/dry/schema/type_container.rb
dry-schema-1.10.4 lib/dry/schema/type_container.rb
dry-schema-1.10.3 lib/dry/schema/type_container.rb
dry-schema-1.10.2 lib/dry/schema/type_container.rb
dry-schema-1.10.1 lib/dry/schema/type_container.rb
dry-schema-1.9.3 lib/dry/schema/type_container.rb
dry-schema-1.9.2 lib/dry/schema/type_container.rb
dry-schema-1.9.1 lib/dry/schema/type_container.rb
dry-schema-1.9.0 lib/dry/schema/type_container.rb
dry-schema-1.8.0 lib/dry/schema/type_container.rb
dry-schema-1.7.1 lib/dry/schema/type_container.rb
dry-schema-1.7.0 lib/dry/schema/type_container.rb
dry-schema-1.6.2 lib/dry/schema/type_container.rb
dry-schema-1.6.1 lib/dry/schema/type_container.rb
dry-schema-1.6.0 lib/dry/schema/type_container.rb