Class: Dry::Schema::Compiler Private
- Inherits:
-
Logic::RuleCompiler
- Object
- Logic::RuleCompiler
- Dry::Schema::Compiler
- 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
-
#supports?(predicate) ⇒ Boolean
private
Return true if a given predicate is supported by this compiler.
-
#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
18 19 20 |
# File 'lib/dry/schema/compiler.rb', line 18 def self.new(predicates = PredicateRegistry.new) super end |
Instance Method Details
#supports?(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
45 46 47 |
# File 'lib/dry/schema/compiler.rb', line 45 def supports?(predicate) predicates.key?(predicate) 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
33 34 35 36 |
# File 'lib/dry/schema/compiler.rb', line 33 def visit_namespace(node, opts = EMPTY_HASH) namespace, rest = node NamespacedRule.new(namespace, visit(rest)) end |