Class: Chemicalml::Convention::Molecular::Constraints::BondMustHaveAtomRefs2

Inherits:
Constraint::NodeConstraint show all
Defined in:
lib/chemicalml/convention/molecular/constraints/bond_must_have_atom_refs2.rb

Instance Method Summary collapse

Methods inherited from Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, path) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/chemicalml/convention/molecular/constraints/bond_must_have_atom_refs2.rb', line 8

def check_node(node, path)
  return [] unless node.is_a?(Chemicalml::Cml::Role::Bond)

  return [] unless node.atom_refs2.to_s.strip.empty?

  [violation(path: path.empty? ? "bond" : path.join("/"),
             message: "bond must have an atomRefs2 attribute")]
end