Sha256: 655b1ca8012ed6f0a81272e0db807adcdd30b250f97243fdcdcf0ef8fb1af0b9

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Schema
    # A registry with predicate objects from `Dry::Logic::Predicates`
    #
    # @api private
    class PredicateRegistry < Dry::Types::PredicateRegistry
      # @api private
      def arg_list(name, *values)
        predicate = self[name]
        # Cater for optional second argument like in case of `eql?` or `respond_to?`
        arity = predicate.arity.abs

        predicate
          .parameters
          .map(&:last)
          .zip(values + Array.new(arity - values.size, Undefined))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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