lib/dry/validation/schema/value.rb in dry-validation-0.9.1 vs lib/dry/validation/schema/value.rb in dry-validation-0.9.2
- old
+ new
@@ -165,17 +165,23 @@
def dyn_arg?(name)
schema_class.instance_methods.include?(name)
end
+ def respond_to?(name)
+ self.class.public_methods.include?(name)
+ end
+
private
def infer_predicates(predicates, infer_on = self)
predicates.map { |predicate|
name, *args = ::Kernel.Array(predicate).first
if name.is_a?(Schema)
infer_on.schema(name)
+ elsif name.respond_to?(:rule)
+ create_rule(name.rule.to_ast)
else
infer_on.__send__(name, *args)
end
}.reduce(:and)
end