Class: Dry::Schema::Compiler Private
- Inherits:
-
Logic::RuleCompiler
- Object
- Logic::RuleCompiler
- Dry::Schema::Compiler
- Includes:
- Extensions::Hints::CompilerMethods
- Defined in:
- lib/dry/schema/compiler.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Extended rule compiler used internally by the DSL
Class Method Summary collapse
-
.new(predicates = PredicateRegistry.new) ⇒ Compiler
private
Builds a default compiler instance with custom predicate registry.
Instance Method Summary collapse
-
#support?(predicate) ⇒ Boolean
private
Return true if a given predicate is supported by this compiler.
- #visit_and(node) ⇒ Object private
-
#visit_namespace(node, _opts = EMPTY_HASH) ⇒ NamespacedRule
private
Build a special rule that will produce namespaced failures.
Class Method Details
.new(predicates = PredicateRegistry.new) ⇒ Compiler
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds a default compiler instance with custom predicate registry
14 15 16 |
# File 'lib/dry/schema/compiler.rb', line 14 def self.new(predicates = PredicateRegistry.new) super end |
Instance Method Details
#support?(predicate) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return true if a given predicate is supported by this compiler
46 47 48 |
# File 'lib/dry/schema/compiler.rb', line 46 def support?(predicate) predicates.key?(predicate) end |
#visit_and(node) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/dry/schema/compiler.rb', line 19 def visit_and(node) super.with(hints: false) end |
#visit_namespace(node, _opts = EMPTY_HASH) ⇒ NamespacedRule
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a special rule that will produce namespaced failures
This is needed for schemas that are namespaced and they are used as nested schemas
34 35 36 37 |
# File 'lib/dry/schema/compiler.rb', line 34 def visit_namespace(node, _opts = EMPTY_HASH) namespace, rest = node NamespacedRule.new(namespace, visit(rest)) end |