Sha256: ffe1a160c59d7f15df5b5f6a4ddd22ebfaa833d4933f1e2501378bd14c85a76c

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require "dry/types/constructor"

module Dry
  module Types
    # Hash type exposes additional APIs for working with schema hashes
    #
    # @api public
    class Hash < Nominal
      class Constructor < ::Dry::Types::Constructor
        # @api private
        def constructor_type
          ::Dry::Types::Hash::Constructor
        end

        # @return [Lax]
        #
        # @api public
        def lax
          type.lax.constructor(fn, meta: meta)
        end

        # @see Dry::Types::Array#of
        #
        # @api public
        def schema(*args)
          type.schema(*args).constructor(fn, meta: meta)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-types-1.5.1 lib/dry/types/hash/constructor.rb
dry-types-1.5.0 lib/dry/types/hash/constructor.rb