Class: Chemicalml::Convention::UnitDictionary::Constraints::UnitListMustContainAtLeastOneUnit
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::UnitDictionary::Constraints::UnitListMustContainAtLeastOneUnit
- Defined in:
- lib/chemicalml/convention/unit_dictionary/constraints/unit_list_must_contain_at_least_one_unit.rb
Overview
A <unitList> element MUST contain one or more <unit>
children, and MUST NOT contain any other CML-namespace
child elements.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/chemicalml/convention/unit_dictionary/constraints/unit_list_must_contain_at_least_one_unit.rb', line 12 def check_node(node, path) return [] if (node.units || []).length.positive? [violation(path: path.join('/'), message: 'unitList must contain at least one unit child')] end |