Class: Schemurai::Internal::Evaluator
- Inherits:
-
Object
- Object
- Schemurai::Internal::Evaluator
- Defined in:
- lib/schemurai/evaluator.rb
Instance Method Summary collapse
- #backend ⇒ Object
-
#initialize(graph, root, content: false, format: false) ⇒ Evaluator
constructor
A new instance of Evaluator.
- #valid?(instance) ⇒ Boolean
- #validate(instance) ⇒ Object
Constructor Details
#initialize(graph, root, content: false, format: false) ⇒ Evaluator
15 16 17 18 19 20 21 22 |
# File 'lib/schemurai/evaluator.rb', line 15 def initialize(graph, root, content: false, format: false) @validate_content = content @validate_format = format @graph = graph @root = root @regexps = nil @active = nil end |
Instance Method Details
#backend ⇒ Object
13 |
# File 'lib/schemurai/evaluator.rb', line 13 def backend = :ruby |
#valid?(instance) ⇒ Boolean
30 31 32 33 34 35 36 37 38 |
# File 'lib/schemurai/evaluator.rb', line 30 def valid?(instance) @error_callback = nil @error_count = 0 @track_dynamic_scope = @graph.dynamic_scope? @dynamic_scope = nil @instance_path = nil @schema_path = nil evaluate_valid(@root, instance) end |
#validate(instance) ⇒ Object
24 25 26 27 28 |
# File 'lib/schemurai/evaluator.rb', line 24 def validate(instance) errors = [] each_error(instance) { |error| errors << error } Result.new(errors) end |