Class: Chemicalml::Convention::Constraint::NodeConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/chemicalml/convention/constraint.rb

Overview

Constraint that walks the document tree once per node and calls check_node(node, path). Subclasses get traversal for free.

Instance Method Summary collapse

Instance Method Details

#check(document) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/chemicalml/convention/constraint.rb', line 60

def check(document)
  violations = []
  walk_nodes(document) do |node, path|
    violations.concat(Array(check_node(node, path)))
  end
  violations
end

#check_node(_node, _path) ⇒ Object



68
69
70
# File 'lib/chemicalml/convention/constraint.rb', line 68

def check_node(_node, _path)
  []
end