lib/dry/schema/trace.rb in dry-schema-1.8.0 vs lib/dry/schema/trace.rb in dry-schema-1.9.0
- old
+ new
@@ -87,17 +87,21 @@
# @api private
def reduced_rule
captures.map(&:to_ast).map(&compiler.method(:visit)).reduce(:and)
end
+ def respond_to_missing?(meth, include_private = false)
+ super || (meth.to_s.end_with?(QUESTION_MARK) && compuiler.support?(meth))
+ end
+
# @api private
def method_missing(meth, *args, &block)
if meth.to_s.end_with?(QUESTION_MARK)
if ::Dry::Schema::Trace::INVALID_PREDICATES.include?(meth)
::Kernel.raise InvalidSchemaError, "#{meth} predicate cannot be used in this context"
end
- unless compiler.supports?(meth)
+ unless compiler.support?(meth)
::Kernel.raise ::ArgumentError, "#{meth} predicate is not defined"
end
predicate = Predicate.new(compiler, meth, args, block)
predicate.ensure_valid