Class: Chemicalml::Convention::Molecular::Constraints::PropertyMustHaveDictRef

Inherits:
Constraint::NodeConstraint show all
Defined in:
lib/chemicalml/convention/molecular/constraints/property_must_have_dict_ref.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/property_must_have_dict_ref.rb', line 8

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

  return [] unless node.dict_ref.to_s.empty?

  [violation(path: path.empty? ? "property" : path.join("/"),
             message: "property must have a dictRef attribute")]
end