Class: Chemicalml::Convention::Molecular::Constraints::BondArrayMustBeChildOfMolecule
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Molecular::Constraints::BondArrayMustBeChildOfMolecule
- Defined in:
- lib/chemicalml/convention/molecular/constraints/bond_array_must_be_child_of_molecule.rb
Overview
Molecular convention: <bondArray> MUST be a child of
<molecule>. Any other parent is invalid.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/chemicalml/convention/molecular/constraints/bond_array_must_be_child_of_molecule.rb', line 10 def check_node(node, path) return [] if molecule?(node) misplaced = node.wire_children.select { |c| bond_array?(c) } misplaced.map do |child| violation( path: (path + [describe(node), describe(child)]).join('/'), message: 'bondArray must be a child of molecule, ' \ "but appears under #{node.element_name.inspect}" ) end end |