Class: Chemicalml::Convention::Spectroscopy::Constraints::SpectrumMustHaveContent

Inherits:
Constraint::NodeConstraint show all
Defined in:
lib/chemicalml/convention/spectroscopy/constraints/spectrum_must_have_content.rb

Overview

A <spectrum> MUST contain at least one of: <xaxis>, <yaxis>, <peakList>. An empty spectrum carries no data.

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
# File 'lib/chemicalml/convention/spectroscopy/constraints/spectrum_must_have_content.rb', line 13

def check_node(node, _path)
  return [] if node.xaxis || node.yaxis || node.peak_list

  [violation(path: yield_path(node),
             message: "spectrum #{node.id.inspect} must contain at least one of " \
                      'xaxis, yaxis, or peakList')]
end