Class: Chemicalml::Convention::Molecular::Constraints::BondOrderOtherMustHaveDictRef

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

Overview

Molecular convention: <bond> with order="other" MUST have a dictRef pointing to the dictionary that defines the order semantics. The warning-level "should not be numeric" rule is separate; this is the hard error.

Instance Method Summary collapse

Methods inherited from Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/chemicalml/convention/molecular/constraints/bond_order_other_must_have_dict_ref.rb', line 13

def check_node(node, path)
  return [] unless node.order.to_s.downcase == 'other'
  return [] unless node.dict_ref.to_s.empty?

  [violation(
    path: (path + [describe(node)]).join('/'),
    message: "bond order 'other' must have a dictRef " \
             'identifying the dictionary entry that defines it'
  )]
end