Class: Chemicalml::Convention::Molecular::Constraints::BondStereoOtherMustHaveDictRef

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

Overview

Molecular convention: <bondStereo> with value other MUST have a dictRef pointing to the convention that defines the stereo semantics.

Instance Method Summary collapse

Methods inherited from Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, path) ⇒ Object



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

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

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