class Dry::Schema::Compiler
Extended rule compiler used internally by the DSL
@api private
Public Class Methods
new(predicates = PredicateRegistry.new)
click to toggle source
Builds a default compiler instance with custom predicate registry
@return [Compiler]
@api private
Calls superclass method
# File lib/dry/schema/compiler.rb, line 18 def self.new(predicates = PredicateRegistry.new) super end
Public Instance Methods
supports?(predicate)
click to toggle source
Return true if a given predicate is supported by this compiler
@param [Symbol] predicate
@return [Boolean]
@api private
# File lib/dry/schema/compiler.rb, line 50 def supports?(predicate) predicates.key?(predicate) end
visit_and(node)
click to toggle source
@api private
Calls superclass method
# File lib/dry/schema/compiler.rb, line 23 def visit_and(node) super.with(hints: false) end
visit_namespace(node, _opts = EMPTY_HASH)
click to toggle source
Build a special rule that will produce namespaced failures
This is needed for schemas that are namespaced and they are used as nested schemas
@param [Array] node @param [Hash] _opts Unused
@return [NamespacedRule]
@api private
# File lib/dry/schema/compiler.rb, line 38 def visit_namespace(node, _opts = EMPTY_HASH) namespace, rest = node NamespacedRule.new(namespace, visit(rest)) end