Class: Chemicalml::Convention::Cascade::Constraints::ReactionSchemeMustHaveContent

Inherits:
Chemicalml::Convention::Constraint::NodeConstraint show all
Defined in:
lib/chemicalml/convention/cascade/constraints/reaction_scheme_must_have_content.rb

Overview

A <reactionScheme> MUST contain at least one <reactionStepList> or <reaction> child. An empty scheme carries no cascade information.

Instance Method Summary collapse

Methods inherited from Chemicalml::Convention::Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, _path) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/chemicalml/convention/cascade/constraints/reaction_scheme_must_have_content.rb', line 14

def check_node(node, _path)
  return [] unless (node.reaction_step_lists || []).empty? &&
                   (node.reactions || []).empty?

  [violation(path: yield_path(node),
             message: "reactionScheme #{node.id.inspect} must contain at least one " \
                      'reactionStepList or reaction')]
end