Class: Chemicalml::Convention::Constraint::NodeConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Chemicalml::Convention::Constraint::NodeConstraint
- 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.
Direct Known Subclasses
Chemicalml::Convention::Compchem::Constraints::CompchemModuleMustContainJobList, Chemicalml::Convention::Compchem::Constraints::JobMustContainInitialization, Dictionary::Constraints::EntryIdsUniqueWithinDictionary, Dictionary::Constraints::EntryMustHaveIdAndTerm, Molecular::Constraints::AtomArrayMustContainAtoms, UnitDictionary::Constraints::UnitMustHaveSymbolAndUnitType, UnitTypeDictionary::Constraints::UnitTypeMustHaveIdAndName
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 |