Sha256: c48d97208697aa45f8b1146ecbf5886383252ed7bff0506d75a23fb28e35a299

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

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